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 #37730] Thu, 22 January 2004 08:11 Go to previous message
tam is currently offline  tam
Messages: 48
Registered: February 2000
Member
Reimar Bauer wrote:

> savoieNoSpam@nsidc.org wrote:
>
>> Reimar Bauer <R.Bauer@fz-juelich.de> writes:
>>
>>
>>> 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?
>>
>>
>>
>> Because '$' is the regular expression for end of line. If you want to
>> have
>> the actual dollar sign, you need to escape it with a back slash first.
>> IDL> print,strsplit(a,'\$',/extr,/regex)
>> ABC DEF
>>
>> Helps?
>>
>> Matt
>>
>
>
> Dear all
>
> Thanks,
>
>
> Is there a function available which returns the key codes of regular
> expression signs.
>
> This is now a bit complicated. I have to use /regex because the
> separation could be done by more as one sign. But if it is a $ or
> something else of a regex code I have to add a \ sign in front.
>
> If a variable is used for the separator have I always to test on this?
>
> The old str_sep routine without regex was much clearer.
>
> regards
> Reimar
>
>

When dealing with regular expressions I normally escape all
non-alphanumeric characters. Not all of them are special, but it's
probably easiest to assume they are. It doesn't hurt to
escape a character that is not special (at least in
other languages).

Of course if you don't have a need for regular expressions, there
is no need to use that keyword.

Tom
[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: Fri Oct 10 13:25:12 PDT 2025

Total time taken to generate the page: 0.40273 seconds