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

Re: regex related...search and delete

by The Perlman (Beadle)
on Jan 14, 2013 at 10:33 UTC ( #1013182=note: print w/ replies, xml ) Need Help??


in reply to regex related...search and delete

bla ...

depending on your textfile this can be indefinitely complex.

are parens ever nested?

is it always (L \d+ W \d+)?

If it's not a fix format I would try to match every parens-pair, and call a function with the match with /e modifier. s/\(.*?\)/kill_LW($&)/ge

- Ron


Comment on Re: regex related...search and delete
Select or Download Code
Replies are listed 'Best First'.
Re^2: regex related...search and delete
by freekngeek (Acolyte) on Jan 14, 2013 at 10:43 UTC
    It's a fix format and it's working now. Thank you for your solution, May be I'll try this some other time.
      > It's a fix format and it's working now.

      no it's not, chorobas solution will delete any "L " outside of parens too.

      if its really a fix format, use something like s/\(L (\d+) W (\d+)\)/($1 $2)/g

      Cheers Rolf

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2015-07-31 04:19 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