Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: regex pattern match problem

by newbio (Beadle)
on Aug 06, 2009 at 15:16 UTC ( #786467=note: print w/ replies, xml ) Need Help??


in reply to regex pattern match problem

Thanks a lot dear Monks for your replies. But, still no clue on how to get output 2,3 and 4 yet? Please guide.


Comment on Re: regex pattern match problem
Replies are listed 'Best First'.
Re^2: regex pattern match problem
by Polyglot (Pilgrim) on Aug 10, 2009 at 05:34 UTC
    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~

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2015-07-31 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls