Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^([A-Za-z0-9][A-Za-z0-9-]*)([\.\_]?[A-Za-z0-9-]+)*(\.[A-Za-z]{2,6})+(\/[A-Za-z][A-Za-z0-9-]+)*$
/

Description

I have a regex like this: /^([A-Za-z0-9][A-Za-z0-9-])([._]?[A-Za-z0-9-]+)(.[A-Za-z]{2,6})+(/[A-Za-z][A-Za-z0-9-]+)*$/ and I want to test the string like: webmail.google.com.qqqqqqqqqqqqqqqqqqq....... But it shows TIMEOUT. I know that string is invalid for given regex. But I do this because when I input this string and make it check with regex in Chrome Browser(Only in Chrome !!!), the page hangs. I want solution for it.

Submitted by sam - 10 years ago