Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Regex to find repeated patterns

by mjscott2702 (Pilgrim)
on Nov 18, 2010 at 09:47 UTC ( #872173=note: print w/ replies, xml ) Need Help??


in reply to Regex to find repeated patterns

Hmmm, as Corion has pointed out, you'll get much better response by showing what you have tried, and in what way it fails.

That being said, does this code do what you are looking for?

use strict; use warnings; my $str = "*L*Name1*L*Name2*L**D*Place1*D*Place2*D**L*Name3*L*"; my @names =$str =~ m/\*L\*(\w+)/g; print "@names\n"; $str =~ s/\*L\*$names[0]//; print "Modified string = $str\n";

Output:

Name1 Name2 Name3
Modified string = *L*Name2*L**D*Place1*D*Place2*D**L*Name3*L*


Comment on Re: Regex to find repeated patterns
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (14)
As of 2015-01-30 00:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (246 votes), past polls