Regular Expressions 101

Save & Share

  • Regex Version: ver. 1
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression

/
/
g

Test String

Code Generator

Generated Code

$re = '/((?<=Center X= )\d+(?= , )|(?<=Center Y= )\d+(?=,))/'; $str = '^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ^@^@^@^@^@^@^@^@DICM^B^@^@^@UL^D^@M-<^@^@^@^B^@^A^@OB^@^@^B^@^@^@^@^A^B^@^B^@UI^ ^^@1.2.840.10008.5.1.4.1.1.88.11^@^B^@^C^@UI,^@2.25.1394455567981633947292924600 3593050180^@^B^@^P^@UI^T^@1.2.840.10008.1.2.1^@^B^@^R^@UI^^^@1.2.826.0.1.3680043 .8.165.100^@^B^@^S^@SH ^@AK_STR_4_0^H^@^E^@CS ^@ISO_IR 192^H^@^R^@DA^H^@20221130^H^@^S^@TM ^@093512.236^H^@^T^@UI^N^@1.2.3.4.5.6.7^@^H^@^V^@UI^^^@1.2.840.10008.5.1.4.1.1.8 8.11^@^H^@^X^@UI,^@2.25.13944555679816339472929246003593050180^@^H^@ ^@DA^H^@202 21130^H^@#^@DA^H^@20221130^H^@0^@TM ^@092002.000^H^@3^@TM ^@093512.236^H^@P^@SH^H^@1835797 ^H^@`^@CS^B^@SR^H^@p^@LO^D^@Agfa^H^@M-^P^@PN^@^ @^H^@^Q^QSQ^@^@^@^@^@^@^P^@^P^@PN^N^P^@ ^@LO^L^@780222402136^P^@ 0^@DA^H^@19780222^P^@@^@CS^B^@F ^X^@^B^PUI^P^@1.2.3.4.5.6.7.20 ^@^M^@UI*^@1.2.82 6.0.1.3680043.8.165.100703.11836029^@ ^@^N^@UI,^@2.25.96426502300340166287633794 410492720461^@ ^@^P^@SH^H^@1835797 ^@Laterality^Q^@IS^B^@1 ^@^S^@IS^B^@1 @^@@M- CS ^@CONTAINER @^@CM- SQ^@^@M-^?M-^?M-^?M-^?M-~M-^?^@M-`M-^?M-^?M-^?M-^?^H^@^@^ASH^ F^@121144^H^@^B^ASH^D^@DCM ^H^@^D^ALO^P^@AKGUN BDT ReportM-~M-^?^MM-`^@^@^@^@M-~ M-^?M-]M-`^@^@^@^@@^@PM- CS^H^@SEPARATE@^@rM-#SQ^@^@^@^@^@^@@^@M-^QM-$CS^H^@PART IAL @^@M-^SM-$CS ^@UNVERIFIED@^@0M-\'SQ^@^@M-^?M-^?M-^?M-^?M-~M-^?^@M-`M-^?M-^?M-^?M-^?@^@^PM- CS^ H^@CONTAINS@^@@M- CS^D^@TEXT@^@CM- SQ^@^@M-^?M-^?M-^?M-^?M-~M-^?^@M-`M-^?M-^?M-^ ?M-^?^H^@^@^ASH^F^@121070^H^@^B^ASH^D^@DCM ^H^@^D^ALO^H^@FindingsM-~M-^?^MM-`^@^ @^@^@M-~M-^?M-]M-`^@^@^@^@@^@`M-!UT^@^@V^@^@^@Abnormal finding 1: Center X= 3711 , Center Y= 1919, Possibility= %74, Type= Benign MC M-~M-^?^MM-`^@^@^@^@M-~M-^?^@M-`M-^?M-^?M-^?M-^?@^@^PM- CS^H^@CONTAINS@^@@M- CS^ D^@TEXT@^@CM- SQ^@^@M-^?M-^?M-^?M-^?M-~M-^?^@M-`M-^?M-^?M-^?M-^?^H^@^@^ASH^F^@12 1077^H^@^B^ASH^D^@DCM ^H^@^D^ALO ^@ConclusionM-~M-^?^MM-`^@^@^@^@M-~M-^?M-]M-`^@^@^@^@@^@`M-!UT^@^@^B^@^@^@- M-~M -^?^MM-`^@^@^@^@M-~M-^?^@M-`M-^?M-^?M-^?M-^?^H^@M-^Y^QSQ^@^@M-^?M-^?M-^?M-^?M-~M -^?^@M-`M-^?M-^?M-^?M-^?^H^@P^QUI^\\^@1.2.840.10008.5.1.4.1.1.1.2^@^H^@U^QUI:^@1. 3.51.0.7.1467808936.33695.24902.40691.22053.24371.51322^@^H^@M-^Y^QSQ^@^@M-^?M-^ ?M-^?M-^?M-~M-^?^@M-`M-^?M-^?M-^?M-^?^H^@P^QUI^\\^@1.2.840.10008.5.1.4.1.1.11.1^H ^@U^QUI,^@2.25.253464016771080552631556563039538460246M-~M-^?^MM-`^@^@^@^@M-~M-^ ?M-]M-`^@^@^@^@M-~M-^?^MM-`^@^@^@^@M-~M-^?M-]M-`^@^@^@^@@^@^PM- CS^H^@CONTAINS@^ @@M- CS^D^@TEXT@^@CM- SQ^@^@M-^?M-^?M-^?M-^?M-~M-^?^@M-`M-^?M-^?M-^?M-^?^H^@^@^A SH^F^@121322^H^@^B^ASH^D^@DCM ^H^@^D^ALO^@^@M-~M-^?^MM-`^@^@^@^@M-~M-^?M-]M-`^@^ @^@^@M-~M-^?^MM-`^@^@^@^@M-~M-^?^@M-`M-^?M-^?M-^?M-^?@^@^PM- CS^H^@CONTAINS@^@@M - CS^D^@TEXT@^@CM- SQ^@^@M-^?M-^?M-^?M-^?M-~M-^?^@M-`M-^?M-^?M-^?M-^?^H^@^@^ASH^ F^@111027^H^@^B^ASH^D^@DCM ^H^@^D^ALO^P^@Image LateralityM-~M-^?^MM-`^@^@^@^@M-~ M-^?M-]M-`^@^@^@^@@^@`M-!UT^@^@^B^@^@^@R M-~M-^?^MM-`^@^@^@^@M-~M-^?M-]M-`^@^@^@'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); // Print the entire match result var_dump($matches);

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 PHP, please visit: http://php.net/manual/en/ref.pcre.php