comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » STREGEX Help Please
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
STREGEX Help Please [message #77682] Mon, 19 September 2011 04:18
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
Hi,

I'm trying to convert some IDL code into GDL and ran into the problem
that GDL doesn't support STRMATCH which we were using extensively. It
does however support STREGEX and I've just about got it working but
wanted to check that I was doing it correctly.

In IDL we had something like:
alt=column_data[where(strmatch(column_header, 'alt'))]

In GDL using stregex I thought the equivalent was: alt =
column_data[where(stregex(column_header, 'alt',/boolean))]

However, this introduced the problem that it also matched any strings
containing alt anywhere within them (for example, "p_alt").

I think the solution is to use anchors like so:

alt = column_data[where(stregex(column_header, '^alt$',/boolean))]

This way, it'll match the string which is (and only is) what we're
trying to match.

Have I got this right? It seems to work but I'm not 100% that it's
robust. Have I done anything stupid or missed an easier solution?

Cheers
[Message index]
 
Read Message
Previous Topic: Re: Left Matrix Division
Next Topic: Re: STREGEX Help Please

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:52:16 PDT 2025

Total time taken to generate the page: 0.00378 seconds