Is there a way to limit a regular expression to 100 characters WITH a regular expression?
\[size=(.*?)\](.*?)\[\/size]
So Look at me!
wouldn't work.
I want to limit the numbers, only allow numbers between 1 and 100.
This question is related to
regex
If you want to restrict valid input to integer values between 1 and 100, this will do it:
^([1-9]|[1-9][0-9]|100)$
Explanation:
This WILL NOT ACCEPT: 1. Zero - 0 2. Any integer preceded with a zero - 01, 021, 001 3. Any integer greater than 100
Hope this helps!
Gez
Limit the length of characters in a regular expression? ^[a-z]{6,15}$'
Limit length of characters or Numbers in a regular expression? ^[a-z | 0-9]{6,15}$'
(^(\d{2})|^(\d{4})|^(\d{5}))$
This expression takes the number of length 2,4 and 5. Valid Inputs are 12 1234 12345
If you want numbers from 1 up to 100:
100|[1-9]\d?
Source: Stackoverflow.com