Regular Expressions 101

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^ (?P<group> (?P<structured> (?P<single> (?P<tag_first> (?P<tag> \d+(?:\/\d+)+ | (?P<repnum>\$+(?:@\^*-?\d*)?) | [\w:!-] )++ (?P<attr> (?P<short_attr> \. (?P<short_val> (?P>repnum) | [\w:!-] )* | \#(?P>short_val)* ) | (?P<long_attr> \[ (?P<attr_pair> (?P<attr_name> \\(?:\\{2})*["'\s] | [^\[\]"'\s\\] )+ \.? (?P<equal_val> = (?P<attr_val> (?P<unquoted_val> \\(?:\\{2})*[\[\]"'\s] | [^\[\]"'\s\\] )+ | (?P<quoted_val> (?P<quote>["']) (?: (?P<escaped_all>\\(?:\\{2})*.) | [^"'\n\\] )* (?P=quote) ) )? )? )? (?:\s+(?P>attr_pair))* \] ) )* | (?P>attr)+ ) (?P<tag_rest> (?P<text> \{ (?P<text_content> (?P>escaped_all) | [^{}\n\\] )* \} ) (?P>attr)* (?: (?P<rep>\*\d*+)? (?P>attr)* (?P<close>\/)? | (?P>close)? (?P>rep)? ) | (?P>rep) (?P>attr)* (?P>text)? (?P>attr)* (?P>close)? | (?P>close) (?P>rep)? )? | (?P<text_first>(?P>text)(?P>attr)*) (?P<text_rest> (?P>rep) (?P>attr)* (?P>close)? | (?P>close) (?P>rep)? )? ) (?: (?P<relation>[>+]|\^+) (?P>group)* )? ) | \( (?P>group)* \) (?P>rep)? (?P>relation)? )+ $
/
gmx

Description

ul>(li*2>a{link$@-})*2 is a valid string that can be expanded by Emmet, while <ul> is not.

Submitted by Chattille - a year ago (Last modified a year ago)