[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Regular Expressions
- Subject: Regular Expressions
- From: Wayne Landsman <landsman(at)mpb.gsfc.nasa.gov>
- Date: Thu, 15 Mar 2001 17:29:53 -0500
- Newsgroups: comp.lang.idl-pvwave
- Organization: Raytheon ITSS
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:24006
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