Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Remove duplicate from the same line..

by hdb (Monsignor)
on Jun 01, 2013 at 17:00 UTC ( #1036473=note: print w/replies, xml ) Need Help??


in reply to Re^2: Remove duplicate from the same line..
in thread Remove duplicate from the same line..

Adding .* after \1 in Atanasius' solution should do the trick as it matches everything up to the trailing \n.

Replies are listed 'Best First'.
Re^4: Remove duplicate from the same line..
by Anonymous Monk on Jun 01, 2013 at 17:28 UTC
    No, it didnt worked!

      You are not very open to experimentation, are you?

      use strict; use warnings; my $str = "Goldman Sachs Group, ... Goldman Sachs Group, Inc."; $str =~ s/ \b (.+) \b [,.\s]* \1.* /$1/gx; print "$str\n";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2021-04-17 17:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?