Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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
Replies are listed 'Best First'.
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 cooling their heels in the Monastery: (6)
As of 2015-08-28 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (334 votes), past polls