SeekerOKnowledge has asked for the wisdom of the Perl Monks concerning the following question:
What I would like to do is reformat & comment these regex's more in the style discussed in perlfaq6. Yet when I break the qr// statement up into multiple lines, I no longer match correctly. Is there a way to do this?my $pattern = qr{<PgfTag `Normal \(T\)'>\s*\n\s*<ParaLine\s*\n\s*<Stri +ng `$oldLabel'>\s*\n}; my $replacement = "<PgfTag `Block Label \(T\)'>\n<ParaLine\n<String `$ +newLabel'>\n"; my $k = 0; $$contents =~ s/$pattern/++$k && $replacement/ge;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: commenting regular expressions?
by herveus (Prior) on Sep 04, 2003 at 18:02 UTC | |
by SeekerOKnowledge (Initiate) on Sep 04, 2003 at 18:08 UTC | |
by Anonymous Monk on Sep 04, 2003 at 18:22 UTC | |
by SeekerOKnowledge (Initiate) on Sep 04, 2003 at 18:28 UTC | |
|
Re: commenting regular expressions?
by ajdelore (Pilgrim) on Sep 04, 2003 at 17:58 UTC | |
|
Re: commenting regular expressions?
by tcf22 (Priest) on Sep 04, 2003 at 17:59 UTC |