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
/
^(?:[[:^print:][:cntrl:]\s]|GIF89.{0,20})*<\?(?:php)?\s*.{0,90}?\/\/default\s*password\s*:\s*byyniana[\s*\#]+\/\/niana\s*shell\s*v\d[\s*:\)\/\w]+shell\s*hasil\s*recoded.{0,110}?(\$\w+)\s*=\s*['"\w\+\/=]+;\s*eval\(str_rot13\(gzinflate\(\w+\(\w+\(\(\1[[:punct:]\s]+$
/
gis
^ asserts position at start of the string
Non-capturing group
(?:[[:^print:][:cntrl:]\s]|GIF89.{0,20})*
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
1st Alternative
[[:^print:][:cntrl:]\s]
Match a single character present in the list below
[[:^print:][:cntrl:]\s]
[:^print:] matches the negation of print
[:cntrl:] matches a control character [\x00-\x1F\x7F]
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
2nd Alternative
GIF89.{0,20}
GIF89
matches the characters GIF89 literally (case insensitive)
.
matches any character
{0,20} matches the previous token between 0 and 20 times, as many times as possible, giving back as needed (greedy)
< matches the character < with index 6010 (3C16 or 748) literally (case insensitive)
\? matches the character ? with index 6310 (3F16 or 778) literally (case insensitive)
Non-capturing group
(?:php)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
php
matches the characters php literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
.
matches any character
{0,90}? matches the previous token between 0 and 90 times, as few times as possible, expanding as needed (lazy)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
default
matches the characters default literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
password
matches the characters password literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
: matches the character : with index 5810 (3A16 or 728) literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
byyniana
matches the characters byyniana literally (case insensitive)
Match a single character present in the list below
[\s*\#]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
* matches the character * with index 4210 (2A16 or 528) literally (case insensitive)
\# matches the character # with index 3510 (2316 or 438) literally (case insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
niana
matches the characters niana literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
shell
matches the characters shell literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
v matches the character v with index 11810 (7616 or 1668) literally (case insensitive)
\d matches a digit (equivalent to [0-9])
Match a single character present in the list below
[\s*:\)\/\w]
shell
matches the characters shell literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
hasil
matches the characters hasil literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
recoded
matches the characters recoded literally (case insensitive)
.
matches any character
1st Capturing Group
(\$\w+)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
= matches the character = with index 6110 (3D16 or 758) literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
Match a single character present in the list below
['"\w\+\/=]
; matches the character ; with index 5910 (3B16 or 738) literally (case insensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
eval
matches the characters eval literally (case insensitive)
\( matches the character ( with index 4010 (2816 or 508) literally (case insensitive)
str_rot13
matches the characters str_rot13 literally (case insensitive)
\( matches the character ( with index 4010 (2816 or 508) literally (case insensitive)
gzinflate
matches the characters gzinflate literally (case insensitive)
\( matches the character ( with index 4010 (2816 or 508) literally (case insensitive)
\w
matches any word character (equivalent to [a-zA-Z0-9_])
\( matches the character ( with index 4010 (2816 or 508) literally (case insensitive)
\w
matches any word character (equivalent to [a-zA-Z0-9_])
\( matches the character ( with index 4010 (2816 or 508) literally (case insensitive)
\( matches the character ( with index 4010 (2816 or 508) literally (case insensitive)
\1 matches the same text as most recently matched by the 1st capturing group
Match a single character present in the list below
[[:punct:]\s]
$ 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
g modifier: global. All matches (don't return after first match)
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
s modifier: single line. Dot matches newline characters
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
gis

Test String