Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Regex OR'ing

by tye (Sage)
on Jul 28, 2000 at 03:13 UTC ( #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>|)');

    Regards,
    spectre

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2020-08-09 04:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (54 votes). Check out past polls.

    Notices?