Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Keep It Simple, Stupid
 
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 studying the Monastery: (11)
As of 2014-04-18 23:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (473 votes), past polls