Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: search and replace question

by Hue-Bond (Priest)
on Mar 11, 2010 at 08:21 UTC ( #827977=note: print w/replies, xml ) Need Help??


in reply to search and replace question

I've tried wildcard'ing the search string but cannot get it to work - I always seem to end up greedily taking up a lot of the rest of the file

Wildcards are greedy by default, which means that they'll take as much as they can, as you have already seen. Try appending a question mark to the quantifier, to make it non-greedy, ie use abc.*? instead of abc.*.

Also - I cannot get my search to find these "search strings" that are split over a line - I guess if I can get the wildcard working I could put a linefeed in there ?

Use the /s modifier in the regex.

--
 David Serrano
 (Please treat my english text just like Perl code, i.e. feel free to notify me of any syntax, grammar, style and/or spelling error. Thank you!).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://827977]
help
Chatterbox?
[ambrus]: Corion: schmorp points out https://metacpan. org/pod/release/ KARASIK/Prima-1. 49/pod/Prima/File. pod,

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2016-12-07 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.