Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: A NOT in regular expressions

by rruiz (Monk)
on May 14, 2003 at 02:56 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://257958]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-03-28 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found