Regular Expressions 101

Save & Share

Flavor

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

Function

  • Match
  • Substitution
  • List
  • Unit Tests
"
<.*[^\x01-\x7E]+.*>
"
uUmg
< matches the character < with index 6010 (3C16 or 748) literally (case sensitive)
.
matches any character, including unicode (except for line terminators)
* matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy)
Match a single character not present in the list below
[^\x01-\x7E]
+ matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
\x01-\x7E matches a single character in the range between  (index 1) and ~ (index 126) (case sensitive)
.
matches any character, including unicode (except for line terminators)
* matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy)
> matches the character > with index 6210 (3E16 or 768) literally (case sensitive)
Global pattern flags
u modifier: unicode case. Apply case insensitive matching to unicode characters in accordance with the unicode standard
U modifier: Unicode. Enable the built in character classes to also match unicode characters
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.

Regular Expression
No Match

"
"
uUmg

Test String

Code Generator

Generated Code

Loading code sample...
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report.
For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html