Regular Expression Longes Possible Matching

Posted by syker on Stack Overflow See other posts from Stack Overflow or by syker
Published on 2010-03-30T22:44:21Z Indexed on 2010/03/30 22:53 UTC
Read the original article Hit count: 351

Filed under:

So I have an input string which is a directory addres:

Example: ProgramFiles/Micro/Telephone

And I want to match it against a list of words very strictly:

Example: Tel|Tele|Telephone

I want to match against Telephone and not Tel. Right now my reg looks like this:

my( $output ) = ( $input =~ m/($list)/o );

The regex above will match against Tel. What can I do to fix it?

© Stack Overflow or respective owner

Related posts about regex