Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: need help to replace string in a line

by moritz (Cardinal)
on Nov 24, 2012 at 16:22 UTC ( #1005390=note: print w/replies, xml ) Need Help??


in reply to need help to replace string in a line

I haven't checked it, but I guess your extensive use of .*? is causing trouble. That can match lots of stuff you don't want it to match. Be more specific!

For example:

/ nf\w* \h* = \h* \d+ /x # ^ don't make the = optional # ^^^ not arbitrary characters, just allow word characters / nf\w+ \h* = \h* \{ [^}]+ \}/ # ^^^^ don't allow a closing bracket inside the bra +ckets

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005390]
help
Chatterbox?
[LanX]: "evacuate to open schoolyard" is standard procedure here
[LanX]: Italy has a problem with Africa, very pushy continent ;-)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2017-01-18 12:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (161 votes). Check out past polls.