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


Comment on Re: A NOT in regular expressions
Download Code

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 rifling through the Monastery: (12)
As of 2014-10-23 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (124 votes), past polls