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
@
(^[^<]+)|(<img[^>]+>)|((?<=>).+?(?=<i))|((?<=>).+?$)
@
isug
1st Alternative
(^[^<]+)
1st Capturing Group
(^[^<]+)
^ asserts position at start of the string
Match a single character not present in the list below
[^<]+
+ Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
< matches the character < literally (case insensitive)
2nd Alternative
(<img[^>]+>)
2nd Capturing Group
(<img[^>]+>)
<img matches the characters <img literally (case insensitive)
Match a single character not present in the list below
[^>]+
+ Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
> matches the character > literally (case insensitive)
> matches the character > literally (case insensitive)
3rd Alternative
((?<=>).+?(?=<i))
3rd Capturing Group
((?<=>).+?(?=<i))
Positive Lookbehind
(?<=>)
Assert that the Regex below matches
> matches the character > literally (case insensitive)
.+?
matches any character, including unicode
+? Quantifier — Matches between one and unlimited times, as few times as possible, expanding as needed (lazy)
Positive Lookahead
(?=<i)
Assert that the Regex below matches
<i matches the characters <i literally (case insensitive)
4th Alternative
((?<=>).+?$)
4th Capturing Group
((?<=>).+?$)
Positive Lookbehind
(?<=>)
Assert that the Regex below matches
> matches the character > literally (case insensitive)
.+?
matches any character, including unicode
+? Quantifier — Matches between one and unlimited times, as few times as possible, expanding as needed (lazy)
$ 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])
s modifier: single line. Dot matches newline characters
u modifier: unicode. Pattern strings are treated as UTF-16. Also causes escape sequences to match unicode characters
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

@
@
isug

Test String