Regular Expressions 101

@regex101
Donate
Sponsor
Contact
Bug Reports & Feedback
Wiki
Whats new?

Library entries

0
javascript
Submitted by anonymous - 10 hours ago

match

ádf
0
python
Submitted by guif - a day ago

regex_restauratio_Vé

regex
0
python
Submitted by guif - a day ago

regex_restauration

regex
0
pcre2
Submitted by fl0 - a day ago

parse/replace closed tag

parse and replace a {tag}..{/tag} or {tag}
0
javascript
Submitted by anonymous - a day ago

Matching anything minimum 1 character, max 50

^.{1,50}$
0
pcre
Submitted by Mark - 3 days ago

RangeForce exercise

exercise
0
pcre2
Submitted by ramses - 4 days ago

email

........

remove comments from php code

Vote

10

Regular Expression
pcre

@
(?(DEFINE) (?<next_open_tag> [^<]*+ (?i: <++[^<?s][^<]* | <++(?! \?php | \?= | script\s*language\s*=\s*([\'"]?)php\g{-1}\s*> ) [^<]* )*+ (?i: <++(?: \?php | \?= | [^>]+ ) | \z ) ) ) \A (?&next_open_tag) \K | [^'"`/#<?]*+ (?: '(?:[^'\\]+|\\.)*+' [^\'"`/#<?]* | "(?:[^"\\]+|\\.)*+" [^\'"`/#<?]* | `(?:[^`\\]+|\\.)*+` [^\'"`/#<?]* | /(?![/*]) [^\'"`/#<?]* # stop for // or /* | # if close tag ?> \? (?: >(?&next_open_tag)[^\'"`/#<?]* | ) | < (?: # heredoc or nowdoc <<[\ \t]*([\'"]?) ([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*) \g{-2}[\ \t]*[\r\n] (?-s:.*+[\r\n])*? \g{-1}[\r\n;] [^\'"`/#<?]* | (?i: /script\s*>) (?&next_open_tag) [^\'"`/#<?]* | [^\'"`/#<?]* ) )*+ \K (?: (?://|\#)(?:[^\n?]+|\?(?!>))*+ # single line comment // и # | /\*(?:[^*]+|\*(?!/))*+\*/ # multi line comment /* */ )?
@
xsg

Description

Loading markdown...
Submitted by anonymous - 6 years ago