Home »
Public Forums »
archive »
Regular Expressions
Regular Expressions [message #24193] |
Thu, 15 March 2001 14:29 |
Wayne Landsman
Messages: 117 Registered: January 1997
|
Senior Member |
|
|
The following is probably a simple question for anyone familiar with
regular expressions, but I am still trying to learn the STREGEX
function.
Suppose I want to find the first occurence in a string of an 'l' ithat
is not part of a double 'l'. For
example, in the string
IDL> st = 'The rolling hills and lake'
I want to return the character position of the 'l' in lake (=21).
The following expression almost works -- it will search for any 'l'
which is both preceded and followed by anything that is not "l"
IDL> print,stregex(st, '[^l]l[^l]' )
but it won't work for the string 'The rolling hills and pool' because
the final 'l' has no characters following it. Any suggestions?
thanks, --Wayne Landsman
landsman@mpb.gsfc.nasa.gov
|
|
|
Current Time: Wed Oct 08 10:57:07 PDT 2025
Total time taken to generate the page: 0.00459 seconds