[regex-coach] Need a Regex to return multi result if matching more than one times

bai haoquan baihaoquan at gmail.com
Sun Jun 5 12:36:37 UTC 2011


Hi all,

I want a  regex used in Perl which is

@ret = $query =~ /(googl.?)|(.?oogle)/;

if the $query is "google",  then will be matched, and the @ret = (google,
undef), $1 = "google", $2 is undef

but I want result like @ret = (google, google), because the
pattern  "(.?oogle)" is matched too,

And my regex is very long (the regex above is just an example), maybe
thouands of "|", so if separate the regex  to /(googl.?)/ and /(.?oogle)/
will be inefficient.



Does anybody can help me?  Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/regex-coach/attachments/20110605/0140286c/attachment.html>


More information about the regex-coach mailing list