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

Home » Public Forums » archive » Re: again strsplit
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: again strsplit [message #37748 is a reply to message #37745] Wed, 21 January 2004 06:48 Go to previous messageGo to previous message
tam is currently offline  tam
Messages: 48
Registered: February 2000
Member
Reimar Bauer wrote:

> Hi all
>
> I have learned the /regex keyword but who could explain this:
>
> a='ABC$DEF'
> print,strsplit(a,'$',/extr)
>
> ABC DEF
>
> and
>
> a='ABC$DEF'
> print,strsplit(a,'$',/extr,/regex)
>
> ABC$DEF
>
>
> Why is this differnt?
>
>
> regards
>
> Reimar

Presuming IDL uses the same conventions for regular
expressions that have been popularized in Perl
I'd assume that if you've turned on regular expressions
that an unescaped $ has the special meaning of matching
the end of the string (and ^ the beginning).

So
print,strsplit(a,'f$', /extr, /regex)
will try to split on a terminal f and you should get

ABC$DE

as the result.

If you want to match with the character '$' then just escape
it with a backslash.

print,strsplit(a,'\$',/extr,/regex)


Regards,
Tom McGlynn
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: "Color vectors" & shading
Next Topic: Re: write unix textfile with windows idl

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

Current Time: Sat Oct 11 22:31:00 PDT 2025

Total time taken to generate the page: 2.40092 seconds