regex - Controlling number of characters in expression? -
can somehow limit number of characters of whole expression?
i want limit number of characters in expression like:
([0-9]+(\.?[0-9]+)*)
i want strings following limit accepted. example, if limit 4:
12.3
gets accepted012
doesn't12345
doesn't.
use anchored ahead (for example max 33):
^(?=.{0,33}$)([0-9]+(\.?[0-9]+)*)
to make exactly 33, remove 0,
to ignore number of periods in limit
^(?=(\.*[^.]){0,33}\.*$)([0-9]+(\.?[0-9]+)*)
Comments
Post a Comment