Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: search and replace

by Anonymous Monk
on Sep 28, 2012 at 08:12 UTC ( #996134=note: print w/ replies, xml ) Need Help??


in reply to search and replace

Dude, perlrequick, Regexp::English, Regexp::Common, Iterator::Files, ARGV::readonly

s{^\Qmail xmlfeedback -s \E(.*)$}{mail -s $1 xmlfeedback}sgx; s{^mail xmlfeedback -s ("feed invalid for agent \d+")\s*$}{mail -s $1 +xmlfeedback}sgx;

use Regexp::English; my $re = Regexp::English -> start_of_line -> literal('mail xmlfeedback -s') -> remember -> literal('"feed invalid for agent ') -> multiple -> digit -> end -> literal('"') -> end -> zero_or_more -> whitespace_char -> end -> end_of_line; print $re; __END__ (?^:^mail\ xmlfeedback\ \-s(\"feed\ invalid\ for\ agent\ (?:\d+)\")(?: +\s*)$)


Comment on Re: search and replace
Select or Download Code
Re^2: search and replace
by Anonymous Monk on Sep 28, 2012 at 08:15 UTC
    use Regexp::English; my $re = Regexp::English -> start_of_line -> literal('mail xmlfeedback -s ') -> remember -> zero_or_more -> non_newline -> end -> end_of_line; print $re; __END__ (?^:^mail\ xmlfeedback\ \-s\ ((?:(?s)[^\n]*)$))

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-08-28 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (257 votes), past polls