Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: regex pattern match problem

by Polyglot (Monk)
on Aug 10, 2009 at 05:34 UTC ( #787249=note: print w/ replies, xml ) Need Help??


in reply to Re: regex pattern match problem
in thread regex pattern match problem

Basically, you might consider something like this:

our $line='Your chemical info here...'; #BASICALLY, MAKE THE SUB DO WHATEVER YOU NEED #THEN PUT THE SUB IN THE REPLACEMENT SIDE OF #THE REGEX. my $ProcessMultiLine = sub { #START OF SUB my $templine = $line; my $temppart = ''; my $returnval = ''; while ($templine =~s/( YourMatchingRegexHere )//) { $temppart = $1; $temppart =~ s/ YourSubsMatch / YourSubsReplace /; $returnval .= $temppart; } #END WHILE return $returnval; } #END SUB $line =~ s/ MatchTheString / $ProcessMultiLine -> () /e;

Blessings,

~Polyglot~


Comment on Re^2: regex pattern match problem
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-07-23 03:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (132 votes), past polls