• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need help with REGEX

azev

Golden Member
so I wanted to create a regex that states all number ending with 0 through 4.
From my reading online this is what i come up with _[0-4]$
is that correct ??


Thx
 
Which language? There are some differences.

Is there a range to the number of digits? or is it anything from one digit to (anything)?

I'd think it'd be more like ^\d+[0-4]$ the ^ is beginning of the line, one or more digit followed by a 0, 1, 2, 3, 4, which would be the last character.

or .*[0-4]$ which would be anything on the line, with a 0, 1, 2, 3, 4 being the last character of the line.

(some) SQL uses the underscore for a single character match, most scripts & languages use the dot to match anything (some with optional match of a line feed / or return), the + is one or more, * is zero or more

Then you can make it "greedy" (in most languages/scripts/utilities) by following the quantifier with a "?"



... and if you needed to capture the number, you'll need to encapsulate some or all of the REGEX with parentheses
 
Back
Top