Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: A NOT in regular expressions

by rruiz (Monk)
on May 14, 2003 at 02:56 UTC ( #257958=note: print w/replies, xml ) Need Help??


in reply to A NOT in regular expressions

You don't post your regular expression for us to take a look at it, but I think that you need to use the non greedy operator '?' in your re. Like:

#!/usr/bin/perl -wT use strict; my $s = 'stuff <% junk %> more stuff <% more junk %> end'; print "$s\n"; $s =~ s/<%.*?%>//g; print "$s\n";

Which makes the re to take the shortest match.

HTH
God bless you
rruiz

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2016-08-30 21:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (423 votes). Check out past polls.