Regular Expressions 101

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

Save & Share

Flavor

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

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
<a href="http.:.(youtube.com|.be\/|.embed\/|watch. v=|(\w)).<\/a>
/
g
<a href="http matches the characters <a href="http literally (case sensitive)
.
matches any character (except for line terminators)
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
: matches the character : literally (case sensitive)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
1st Capturing Group
(youtube.com|.be\/|.embed\/|watch. v=|(\w))
1st Alternative
youtube.com
youtube matches the characters youtube literally (case sensitive)
. matches any character (except for line terminators)
com matches the characters com literally (case sensitive)
2nd Alternative
.be\/
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
be matches the characters be literally (case sensitive)
\/ matches the character / literally (case sensitive)
3rd Alternative
.embed\/
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
embed matches the characters embed literally (case sensitive)
\/ matches the character / literally (case sensitive)
4th Alternative
watch. v=
watc matches the characters watc literally (case sensitive)
h
matches the character h literally (case sensitive)
. matches any character (except for line terminators)
v= matches the characters v= literally (case sensitive)
5th Alternative
(\w)
.
matches any character (except for line terminators)
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
< matches the character < literally (case sensitive)
\/ matches the character / literally (case sensitive)
a> matches the characters a> literally (case sensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.

Regular Expression
No Match

/
/
g

Test String