Evan <> wrote:
> I have multiple patterns to search within each string defined in a
> separate file.
>
> Departure|Arrival
> MORNING|AFTERNOON
>
> Need to search for the occurence and position of pattern 1, if found,
> search for the occurence and position of pattern 2 and so on. The
> search for reasons needs to be done in a backward direction.
>
> Looked at rindex. It searches the string right to left but the problem
> using it is that the string cannot be a regexp.
So far you haven't said anything that *requires* a regex.
> So the only option remains is to use a regexp.
^^^^^^^^^^^^^^^
Then there is something you are not telling us.
> Could anyone suggest any ideas in the direction of approaching this
> problem.
Call rindex() 4 times instead of doing 2 pattern matches with 2 alternatives.
--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas