Regular Expressions 101

Sponsors

Library entries

0
javascript

import syntax for regex with grouping

HAYO!
Submitted by CreeJee - 11 hours ago
0
pcre2

Semver regex

Example of regex for semver with pre-releases
Submitted by anonymous - 12 hours ago
0
pcre2

Números reales

Números reales
Submitted by Carlos Osmar - a day ago
0
pcre2

Validación de fecha

Este código validará la fecha
Submitted by Carlos Osmar - a day ago
0
pcre2

Doble Espacio

Encuentra texto con toble espacio
Submitted by Carlos Osmar - a day ago
0
javascript

Capture Words

Get each word from a text.
Submitted by anonymous - 2 days ago
0
pcre

Negative search

Seach pattern that doesn't match
Submitted by Gael Langlais - 2 days ago
0
javascript

File extension

Parse file extension.
Submitted by Webmato - 2 days ago
0
java

date dd.mm.yyyy

Date format dd.mm.yyyy
Submitted by anonymous - 2 days ago
0
pcre2

Invoice nr

regexp search in mongo db by nr
Submitted by Tivadar - 3 days ago
0
python

apdl flst

apdl flst
Submitted by anonymous - 3 days ago

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 - 8 years ago