For example, if I have the string:0123456789
I would write expresion like this:0.*9 WHERE PATTERN MAX SIZE is 3. in this case, pattern should fail.
The specific solution to your example is:
/^0.?9$/
The general solution to your abstract question is:
/^(?=.{0,3}$)0.*9$/
In the above (?=.{0,3}$)
is a lookahead that the rest of the string has length between 0 and 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With