[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regular expressions



James Tappin wrote:
> 
> Does there exist a routine for regular expression matching in IDL?
> 
> I'm thinking of something along the lines of an extended STR_SEP that could
> (say) separate a string into components separated by 0 or 1 commas and an
> arbitrary number of spaces.
> 
> I could do it by spawning a perl script but that's not too pretty and I
> can't see an _easy_ way to do it natively.

The STREGEX function was introduced in IDL 5.3:

"The STREGEX function performs regular expression matching against the
strings contained in StringExpression. STREGEX can perform either a
simple boolean True/False evaluation of whether a match occurred, or it
can return the position and offset within the strings for each match.
The regular expressions accepted by this routine, which correspond to
"Posix Extended Regular Expressions", are similar to those used by such
UNIX tools as egrep, lex, awk, and Perl."

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley