Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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*

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://872173]
help
Chatterbox?
and a kettle whistles...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2018-01-19 14:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (219 votes). Check out past polls.

    Notices?