Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: How can I reduce this with a REGEX?

by hazylife (Monk)
on Mar 15, 2014 at 10:47 UTC ( [id://1078433]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How can I reduce this with a REGEX?
in thread How can I reduce this with a REGEX?

Which can probably be further reduced to:
$ cat 1078350.in 12-12 12-12-12 12-13-12-13 12-12-13-13 12-13-13-14 $ perl -pe '1 while s/(\d\d)(.*?)(?:-\1)/$1$2/g' 1078350.in 12 12 12-13 12-13 12-13-14

Replies are listed 'Best First'.
Re^4: How can I reduce this with a REGEX?
by misterperl (Pilgrim) on Mar 17, 2014 at 14:54 UTC
    $ perl -pe '1 while s/(\d\d)(.*?)(?:-\1)/$1$2/g' 1078350.in thanks I like this construct, never saw it before.. You got my ++ vote...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-24 01:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found