Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Regex OR'ing

by tye (Sage)
on Jul 28, 2000 at 03:13 UTC ( [id://24775]=note: print w/replies, xml ) Need Help??

in reply to Regex OR'ing

$var =~ /regex(catch_this)/ || $var =~ /.{0}/;

Regex always prefer matches early in the string. For two matches starting at the same point in the string, regex prefers the one matching elements leftmost in an alternation, where alternations early in the regex are more important than those later. To break ties here, the regex prefers longer matches (or shorter matches for non-greedy elements).

Whether my snippet of code is of any use to you probably depends on other details you didn't mention.

Replies are listed 'Best First'.
RE: Re: Regex OR'ing
by spectre (Scribe) on Jul 28, 2000 at 03:23 UTC
    Ah, to clarify, I'm writing a module for a harness, I dont actually have the option of doing it that way.

    The interface needs to be like the following:
    $this->regex('key','regex'); In this case : $this->regex('high_bidder','(?:Date . Time<.B>.*?1\.<.B><.FONT><.TD> +\s+<TD[^>]+><FONT[^>]+>(.*?)<.FONT>|)');


Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 09:51 GMT
Find Nodes?
    Voting Booth?

    No recent polls found