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 accepted
  • 012 doesn't
  • 12345 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

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -