SimpleRegex/SRL-PHP

Rename "number" to "digit"

SamTebbs33 opened this issue ยท 7 comments

The word number implies a sequence of one or more digits (perhaps with an optional hyphen at the start) while it actually represents a single digit in SRL (see the port capture group in the URL valdiation section here), so "number" should be renamed to "digit" as this is exactly what it represents. Perhaps "number" could then be implemented as an acutal sequence of multiple digits.

lol

To me "number" is ok.

Number does still kinda encapsulate digits too - seems slightly pedantic to me, but you do have a point i guess

"number" seems misleading and people may expect it to compile to something like [0-9]+, which could cause unnecessary confusion/frustration when creating and debugging the regexes

After using the library, I think '''digit''' is preferred over '''number'''. This would free up the possibility for future usage of '''number''' too!

Digit examples: 008361736610, 00, 153
Number examples: 0123, 5.67, 7,123.22, 34.5678, 1.234,56 (international)

I agree with @SamTebbs33. "Digit" seems a more clear representation of a singleton, and "number" sounds like two or more digits. Remember, this tool isn't just for seasoned regex folks.

Using number instead of digit is especially bad when using from-to.

starts with number from 5 to 7

it sounds like you can write something like this

start with number from 15 to 75