I want to search a string for patterns but starting the search from the
_end_ instead of from the beginning, using a regular expression.

For instance I want to find the last 'E' in the string

 

...looong string possibly with many E's.......E.....no capital e'
here...3456

 

The regular expression E$ will match an 'E' but only if it is at the
very end. That's not the (only) match I want - also the E in '...E123'
should match.

 

One obvious solution is to reverse the string and use normal methods to
find the first 'E', but there must be smarter ways, as this appears to
be a relatively common problem to solve. Isn't it?

 

Any hints are welcome.

Thanks from

henning

Reply via email to