Regular Expressions 101

Save & Share

  • Save new Regex
    ctrl+s
  • Update 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
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
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • 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

/
/
gm

Test String

Code Generator

Generated Code

$re = '/\${(\${(.*?:|.*?:.*?:-)(\'|"|`)*(?1)}*|[jndi:lapsrm](\'|"|`)*}*){9,11}/m'; $str = '[>] jndi inject model start... [+] Raw payload: ${jndi:ldap://127.0.0.1:1099/obj} [+] {[upper|lower]:x} Random obfuscate: ${${upper:j}ndi:ldap${lower::}//127${lower:.}${lower:0}.0.1${lower::}1${lower:0}9${lower:9}/ob${lower:j}} [+] {[upper|lower]:x} all the obfuscate: ${${upper:j}${lower:n}${lower:d}${lower:i}${lower::}${lower:l}${lower:d}${lower:a}${lower:p}${lower::}${lower:/}${lower:/}${lower:1}${lower:2}${lower:7}${lower:.}${lower:0}${lower:.}${lower:0}${lower:.}${lower:1}${lower::}${lower:1}${lower:0}${lower:9}${lower:9}${lower:/}${lower:o}${lower:b}${lower:j}} [+] {::-n} random obfuscate: ${jn${zwbIes:o:Bmmy:YGM:IoEt:-d}${nNJ:bP:LLecz:-i}${V:aTCz:SMYnf:nVwz:iWrhM:-:}l${IkcQG:KqY:DNlC:blYP:-d}${dMnno:LY:lm:o:gfceFK:-a}${YRLF:-p}${oPWM:tEf:Nm:B:gtF:-:}${Kw:-/}/12${oyBx:-7}.${fGURHq:jUkxp:LiRat:TFGT:-0}${RsEN:-.}${gqxRsv:-0}.${DP:A:zc:Bxk:-1}${Fgp:xnDqO:ymI:Ei:OiGvf:-:}109${BNuY:RNph:VQ:-9}${OEB:mqId:ShLsGJ:WGCQ:-/}o${JQ:ipL:PkyY:-b}j} [+] {::-n} all the obfuscate: ${${w:Diwn:-j}${nefD:Xih:oCs:l:-n}${cFCwSi:AA:tOqrpE:-d}${fC:ap:uQ:jOT:Dw:-i}${lMK:HQnIQ:Tdn:MzzGN:-:}${dumM:-l}${d:wSdIa:Ot:-d}${XB:oktyjp:QTCl:-a}${KbVE:YOA:qRaof:z:nwv:-p}${XFMG:B:uz:gb:-:}${pBmmGn:waCidF:TXkIzf:-/}${bnb:Qi:vhQi:-/}${spw:t:Lgo:fmcGv:-1}${PvEYM:T:FpFw:c:C:-2}${Tzd:Sn:WXeQ:-7}${cg:xw:qoJuX:NVjaam:-.}${P:vkp:MP:YgX:DoHSm:-0}${jAO:i:zlpnK:aeGVI:YFHd:-.}${jDvpmy:xc:-0}${g:XCXx:yQImF:-.}${QQ:GYcUYC:-1}${CON:XEI:EcX:REGEIc:-:}${ipIDmp:jVt:-1}${LHjMhu:liwEPU:qFQRj:PL:-0}${nUfCc:TKhXP:Slx:IY:-9}${cbEh:vz:Szv:-9}${eFAO:F:-/}${fqUl:EElTW:Jbm:e:WOJDWw:-o}${CewNm:arlr:-b}${DULc:DFbNv:JMEG:i:-j}} [=] jndi inject model stop '; 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