Regular Expressions 101

@regex101
Donate
Sponsor
Contact
Bug Reports & Feedback
Wiki
Whats new?

Save & Share

  • Save Regex
    ctrl+s
  • Update Regex
    ctrl+⇧+s

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python 2.7
  • Golang (RE2)

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
^.{0,30}(^|\W)(anybody|anyone|doubt|help|please|problem|question|somebody|someone|think)(\W|$).{0,30}$
/
i
^ asserts position at start of the string
.{0,30}
matches any character (except for line terminators)
{0,30} Quantifier — Matches between 0 and 30 times, as many times as possible, giving back as needed (greedy)
1st Capturing Group
(^|\W)
1st Alternative
^
^ asserts position at start of the string
2nd Alternative
\W
\W matches any non-word character (equal to [^a-zA-Z0-9_])
2nd Capturing Group
(anybody|anyone|doubt|help|please|problem|question|somebody|someone|think)
1st Alternative
anybody
anybody matches the characters anybody literally (case insensitive)
2nd Alternative
anyone
anyone matches the characters anyone literally (case insensitive)
3rd Alternative
doubt
doubt matches the characters doubt literally (case insensitive)
4th Alternative
help
help matches the characters help literally (case insensitive)
5th Alternative
please
please matches the characters please literally (case insensitive)
6th Alternative
problem
7th Alternative
question
8th Alternative
somebody
9th Alternative
someone
10th Alternative
think
3rd Capturing Group
(\W|$)
1st Alternative
\W
\W matches any non-word character (equal to [^a-zA-Z0-9_])
2nd Alternative
$
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
.{0,30}
matches any character (except for line terminators)
{0,30} Quantifier — Matches between 0 and 30 times, as many times as possible, giving back as needed (greedy)
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
Global pattern flags
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
i

Test String