Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: regex help! (regexplain)

by Anonymous Monk
on Jul 12, 2013 at 09:59 UTC ( #1043929=note: print w/replies, xml ) Need Help??


in reply to regex help!

Does this help any, or is it just too confusing?
         
    # my $regstr = join '', ; # The regular expression (PPI::Token::Regexp::Substitute): ; #
# s/(=head1 .*)\n\n=head2 \*{3}/$1/g
#
# matches as follows:
#r: PPIx::Regexp / PPI::Token::Regexp::Substitute
#r= "s/(=head1 .*)\\n\\n=head2 \\*{3}/\$1/g"
#
          "s",
      # address=/1/C0 ; xRe::Token::Structure ; Represent structural elements.
#"s",
# ------------------------------------------------------------------
               
       # address=/1/C1 ; xRe::Structure::Regexp ; Represent the top-level regular expression
# ------
            "/",
       # address=/1/C1/S0 ; xRe::Token::Delimiter ; Represent the delimiters of the regular expression
#"/",
# ------------------------------------------------------------------
                     
          # # address=/1/C1/C0 ; xRe::Structure::Capture ; Represent capture parentheses.
# number=1 alias "$1" or "\1"
# ------------
                  "(",
          # address=/1/C1/C0/S0 ; xRe::Token::Structure ; Represent structural elements.
#"(",
# ------------------------------------------------------------------
                      "=",
            # # address=/1/C1/C0/C0 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 61 ) ) alias \N{U+003D} alias \075 alias =
#"=",
# ------------------------------------------------------------------
                      "h",
            # # address=/1/C1/C0/C1 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 104 ) ) alias \N{U+0068} alias \150 alias h
#"h",
# ------------------------------------------------------------------
                      "e",
            # # address=/1/C1/C0/C2 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 101 ) ) alias \N{U+0065} alias \145 alias e
#"e",
# ------------------------------------------------------------------
                      "a",
            # # address=/1/C1/C0/C3 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 97 ) ) alias \N{U+0061} alias \141 alias a
#"a",
# ------------------------------------------------------------------
                      "d",
            # # address=/1/C1/C0/C4 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 100 ) ) alias \N{U+0064} alias \144 alias d
#"d",
# ------------------------------------------------------------------
                      1,
            # # address=/1/C1/C0/C5 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 49 ) ) alias \N{U+0031} alias \061 alias 1
# ------------------------------------------------------------------
                      " ",
            # # address=/1/C1/C0/C6 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 32 ) ) alias \N{U+0020} alias \040 alias
#" ",
# ------------------------------------------------------------------
                      ".",
            # # address=/1/C1/C0/C7 ; xRe::Token::CharClass::Simple ; This class represents a simple character class
# any character except \n
# L<perlrecharclass/.>
# L<perlrebackslash/.>
#".",
# ----------------
                      "*",
            # # address=/1/C1/C0/C8 ; 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=/1/C1/C0/C7
#"*",
# ----------------
                  ")",
          # # address=/1/C1/C0/F0 ; xRe::Token::Structure ; Represent structural elements.
# end of grouping for number=1 alias "$1" or "\1"
#")",
# ------------------------------------------------------------------
                "\\n",
         # # address=/1/C1/C1 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 10 ) ) alias \N{U+000A} alias \012 alias LINE FEED (LF) alias
# '\n' (newline)
#"\\n",
# ------------------------------------------------------------------
                "\\n",
         # # address=/1/C1/C2 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 10 ) ) alias \N{U+000A} alias \012 alias LINE FEED (LF) alias
# '\n' (newline)
#"\\n",
# ------------------------------------------------------------------
                "=",
         # # address=/1/C1/C3 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 61 ) ) alias \N{U+003D} alias \075 alias =
#"=",
# ------------------------------------------------------------------
                "h",
         # # address=/1/C1/C4 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 104 ) ) alias \N{U+0068} alias \150 alias h
#"h",
# ------------------------------------------------------------------
                "e",
         # # address=/1/C1/C5 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 101 ) ) alias \N{U+0065} alias \145 alias e
#"e",
# ------------------------------------------------------------------
                "a",
         # # address=/1/C1/C6 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 97 ) ) alias \N{U+0061} alias \141 alias a
#"a",
# ------------------------------------------------------------------
                "d",
         # # address=/1/C1/C7 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 100 ) ) alias \N{U+0064} alias \144 alias d
#"d",
# ------------------------------------------------------------------
                2,
         # # address=/1/C1/C8 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 50 ) ) alias \N{U+0032} alias \062 alias 2
# ------------------------------------------------------------------
                " ",
         # # address=/1/C1/C9 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 32 ) ) alias \N{U+0020} alias \040 alias
#" ",
# ------------------------------------------------------------------
                "\\*",
         # # address=/1/C1/C10 ; xRe::Token::Literal ; a literal character
# ordinal= ord( chr( 42 ) ) alias \N{U+002A} alias \052 alias *
#"\\*",
# ------------------------------------------------------------------
                  "{3}",
          # # address=/1/C1/C11 ; xRe::Structure::Quantifier ; Represent curly bracket quantifiers
# (matching the most amount possible)
# match the preceding pattern at address=/1/C1/C10
# Match exactly n times
# {n}
# Match exactly 3 times
# L<perlre/Quantifiers>
#"{3}",
# ------------
            "/",
       # address=/1/C1/F0 ; xRe::Token::Delimiter ; Represent the delimiters of the regular expression
#"/",
# ------------------------------------------------------------------
               
       # address=/1/C2 ; xRe::Structure::Replacement ; Represent the replacement in s///
# ------
                "\$1",
         # # address=/1/C2/C0 ; xRe::Token::Interpolation ; Represent an interpolation in the PPIx::Regexp package.
# It is a variable! whose contents are used as a pattern, subject to \F\l\u\L\U\Q\E
# L<perlre/\F\l\u\L\U\Q\E>
# subject to L<perlre/Modifiers>
#"\$1",
# ------------------------------------------------------------------
            "/",
       # address=/1/C2/F0 ; xRe::Token::Delimiter ; Represent the delimiters of the regular expression
#"/",
# ------------------------------------------------------------------
          "g",
      # # address=/1/C3 ; xRe::Token::Modifier ; Represent (trailing) modifiers for match, substitution, regexp constructor
# mods( g = 1 )
#"g",
# ------------------------------------------------------------------
         
    ;;;;;;;;;;

Replies are listed 'Best First'.
Re^2: regex help! (regexplain)
by Anonymous Monk on Jul 12, 2013 at 10:07 UTC
    hah, xRe::Token::Interpolation inside xRe::Structure::Replacement is not used as a pattern, one more todo item
Re^2: regex help! (regexplain)
by anek77713 (Acolyte) on Jul 12, 2013 at 10:03 UTC
    WoW !! that is cool!! Thnx!! didn't know this hint!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1043929]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2022-06-30 07:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (97 votes). Check out past polls.

    Notices?