Adding "Max Length" to Regex
Posted
by
SeToY
on Stack Overflow
See other posts from Stack Overflow
or by SeToY
Published on 2012-12-17T22:56:11Z
Indexed on
2012/12/17
23:03 UTC
Read the original article
Hit count: 470
How can I extend already present Regex's with an attribute telling that the regex can't exceed a maximum length of (let's say) 255?
I've got the following regex:
([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)
I've tried it like that, but failed:
{.,255([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)}
© Stack Overflow or respective owner