There is always wxPPIxregexplain.pl/ ppixregexplain.pl
# my $regstr = join '', # # The regular expression (PPI::Token::Regexp::Match): # # # # /(?<start>.*?)((?!\< *\/[\w\d\-]+\>).)*/ # # # # matches as follows: # #r: PPIx::Regexp / PPI::Token::Regexp::Match # #r= "/(?<start>.*?)((?!\\< *\\/[\\w\\d\\-]+\\>).)*/" # # # address=/2/C0 # xRe::Token::Structure # Represent structural elements. "", # ------------------------------------------------------------------ # address=/2/C1 # xRe::Structure::Regexp # Represent the top-level regular expression # perl_version_introduced=5.009005 # ------ # address=/2/C1/S0 # xRe::Token::Delimiter # Represent the delimiters of the regular expression "/", # ------------------------------------------------------------------ # address=/2/C1/C0 # xRe::Structure::NamedCapture # a named capture # L<<< perlre/(?<NAME>pattern) >>> # L<perlvar/%+> # perl_version_introduced=5.009005 # number=1 alias "$1" or "\1" # name=start alias "\g{start}" alias "\k<start>" alias +"(?&start)" alias "(?P>start)" alias "$+{start}" # ------------ # address=/2/C1/C0/S0 # xRe::Token::Structure # Represent structural elements. "(", # ------------------------------------------------------------------ # address=/2/C1/C0/T0 # xRe::Token::GroupType::NamedCapture # "?<start>", # ------------------------------------------------------------------ # address=/2/C1/C0/C0 # xRe::Token::CharClass::Simple # This class represents a simple character class # any character except \n # L<perlrecharclass/.> # L<perlrebackslash/.> ".", # ---------------- # address=/2/C1/C0/C1 # xRe::Token::Quantifier # Represent an atomic quantifier. # match preceding pattern 0 or more times # (matching the least amount possible) # match the preceding pattern at address=/2/C1/C0/C +0 "*", # address=/2/C1/C0/C2 # xRe::Token::Greediness # a greediness qualifier. # and matching (preceding pattern) the least amount + possible # Match shortest string first # match the preceding pattern at address=/2/C1/C0/C +0 "?", # ------------------------------------------------------------------ # address=/2/C1/C0/F0 # xRe::Token::Structure # Represent structural elements. # end of grouping for number=1 alias "$1" or "\1" # end of grouping for name=start alias "\g{start}" alia +s "\k<start>" alias "(?&start)" alias "(?P>start)" alias "$+{start}" ")", # ------------------------------------------------------------------ # address=/2/C1/C1 # xRe::Structure::Capture # Represent capture parentheses. # number=2 alias "$2" or "\2" # ------------ # address=/2/C1/C1/S0 # xRe::Token::Structure # Represent structural elements. "(", # ------------------------------------------------------------------ # address=/2/C1/C1/C0 # xRe::Structure::Assertion # a parenthesized assertion # (the grouptype below explains which one) # ------------------ # address=/2/C1/C1/C0/S0 # xRe::Token::Structure # Represent structural elements. "(", # ------------------------------------------------------------------ # address=/2/C1/C1/C0/T0 # xRe::Token::GroupType::Assertion # a look ahead or look behind assertion # (?!pattern) # L<perlre/(?!pattern)> # A zero-width negative look-ahead assertion. # For example C</foo(?!bar)/> matches any occur +rence of "foo" that is NOT followed by "bar". # Note however that look-ahead and look-behind +are NOT the same thing. # You cannot use this for look-behind. "?!", # ------------------------------------------------------------------ # address=/2/C1/C1/C0/C0 # xRe::Token::Literal # a literal character # ordinal= ord( chr( 60 ) ) alias \N{U+003C} +alias \074 alias LESS-THAN SIGN alias < "\\<", # ------------------------------------------------------------------ # address=/2/C1/C1/C0/C1 # xRe::Token::Literal # a literal character # ordinal= ord( chr( 32 ) ) alias \N{U+0020} +alias \040 alias SPACE alias " ", # ------------------------------------------------------------------ # address=/2/C1/C1/C0/C2 # xRe::Token::Quantifier # Represent an atomic quantifier. # match preceding pattern 0 or more times # (matching the most amount possible) # match the preceding pattern at address=/2/C +1/C1/C0/C1 "*", # ---------------------- # address=/2/C1/C1/C0/C3 # xRe::Token::Literal # a literal character # ordinal= ord( chr( 47 ) ) alias \N{U+002F} +alias \057 alias SLASH alias / "\\/", # ------------------------------------------------------------------ # address=/2/C1/C1/C0/C4 # xRe::Structure::CharClass # a character class # ------------------------ # address=/2/C1/C1/C0/C4/S0 # xRe::Token::Structure # Represent structural elements. "[", # ------------------------------------------------------------------ # address=/2/C1/C1/C0/C4/C0 # xRe::Token::CharClass::Simple # This class represents a simple cha +racter class # L<perlrecharclass/\w> # L<perlrebackslash/\w> "\\w", # ---------------------------- # address=/2/C1/C1/C0/C4/C1 # xRe::Token::CharClass::Simple # This class represents a simple cha +racter class # L<perlrecharclass/\d> # L<perlrebackslash/\d> "\\d", # ---------------------------- # address=/2/C1/C1/C0/C4/C2 # xRe::Token::Literal # a literal character # ordinal= ord( chr( 45 ) ) alias \N{U+ +002D} alias \055 alias HYPHEN-MINUS alias - "\\-", # ------------------------------------------------------------------ # address=/2/C1/C1/C0/C4/F0 # xRe::Token::Structure # Represent structural elements. "]", # ------------------------------------------------------------------ # address=/2/C1/C1/C0/C5 # xRe::Token::Quantifier # Represent an atomic quantifier. # match preceding pattern 1 or more times # (matching the most amount possible) # match the preceding pattern at address=/2/C +1/C1/C0/C4 "+", # ---------------------- # address=/2/C1/C1/C0/C6 # xRe::Token::Literal # a literal character # ordinal= ord( chr( 62 ) ) alias \N{U+003E} +alias \076 alias GREATER-THAN SIGN alias > "\\>", # ------------------------------------------------------------------ # address=/2/C1/C1/C0/F0 # xRe::Token::Structure # Represent structural elements. ")", # ------------------------------------------------------------------ # address=/2/C1/C1/C1 # xRe::Token::CharClass::Simple # This class represents a simple character class # any character except \n # L<perlrecharclass/.> # L<perlrebackslash/.> ".", # ---------------- # address=/2/C1/C1/F0 # xRe::Token::Structure # Represent structural elements. # end of grouping for number=2 alias "$2" or "\2" ")", # ------------------------------------------------------------------ # address=/2/C1/C2 # xRe::Token::Quantifier # Represent an atomic quantifier. # match preceding pattern 0 or more times # (matching the most amount possible) # WARNING only the LAST repetition of the captured patter +n will be stored in "$2" # match the preceding pattern at address=/2/C1/C1 "*", # ---------- # address=/2/C1/F0 # xRe::Token::Delimiter # Represent the delimiters of the regular expression "/", # ------------------------------------------------------------------ # address=/2/C2 # xRe::Token::Modifier # Represent 1)embedded pattern-match modifiers or 2)(trailing) +modifiers for operators match, substitution, regexp constructor "", # ------------------------------------------------------------------ # ;;;;;;;;;; # __END__ #PPIx::Regexp=HASH(0x178f11c) /(?<start>.*?)((?!\< *\/[\w\d\-]+\>).)*/
And rxrx
(?<start> # The start of a named capturing block (also $1)
.*? # Match any character (except newline), zero-or-more times (as few as possible)
) # The end of the named capturing block
( # The start of a capturing block ($2)
(?! # Match negative lookahead
\< * # Match a literal '<' character, zero-or-more times (as many as possible)
/ # Match a literal '/' character
[\w\d\-]+ # Match any of the listed characters, one-or-more times (as many as possible)
\> # Match a literal '>' character
) # The end of negative lookahead
. # Match any character (except newline)
)* # The end of $2 (matching zero-or-more times (as many as possible))
Neither are perfect but they're almost perfect :P
In reply to Re^2: regex catch pattern that doesn't contain a pattern
by Anonymous Monk
in thread regex catch pattern that doesn't contain a pattern
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |