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

Home » Public Forums » archive » Re: 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
Re: STREGEX Help Please [message #77681] Mon, 19 September 2011 05:36
Vincent Sarago is currently offline  Vincent Sarago
Messages: 34
Registered: September 2011
Member
Hi,

That should work, but you have to be sure, that the value you are
looking for is 'alt' and not ' alt' or ' alt '.

Another thing,

" where(stregex(column_header, '^alt$',/boolean)) " can give '-1' if
'alt' is not fount in column_header !!!

From IDL8.0, ittvis has introduce the negative array indexing, so you
have to be really careful with the where() function.
(I don't know how GDL will work.)

It will be better to to :

test = where(stregex(column_header, '^alt$',/boolean), count)
if count ne 0 then alt = column_header[test] else message, 'No alt
Found'


Cheers,

Vincent

On 19 sep, 13:18, Rob <rj...@le.ac.uk> wrote:
> 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: STREGEX Help Please
Next Topic: Re: A rectangle coming up above the parentheses!

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

Current Time: Wed Oct 08 15:06:47 PDT 2025

Total time taken to generate the page: 0.00411 seconds