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

Home » Public Forums » archive » quick strsplit question
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: quick strsplit question [message #59196 is a reply to message #59073] Fri, 07 March 2008 05:56 Go to previous messageGo to previous message
rlayberry is currently offline  rlayberry
Messages: 33
Registered: November 2004
Member
On 6 Mar, 10:25, Nigel Wade <n...@ion.le.ac.uk> wrote:
> rlaybe...@hotmail.com wrote:
>> Hi
>
>> I am, trying to split an number of terms such as str9=dg_eyemouth.out
>
>> to take off the file extension
>
>>  print,strsplit(str9,'.out',/extract,/regex)
>
>> but this gives
>
>> dg_eye h
>
>> any ideas
>
>> thanks
>
>> russ
>
> You've specified /regex. The character "." is a special character in a regex
> which matches anything. So ".out" will match "mout".
>
> You can remove the special nature of "." by preceding it with a backslash. You
> should probably also tie the match to the end of the string by appending a
> dollar:
> print,strsplit(str9,'\.out$',/extract,/regex).
>
> A better approach might be to use the function file_basename:
>
> print,file_basename(str9,[".out"])
>
great, thanks both of the above
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Workspace unavailable
Next Topic: end-of-line termination

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

Current Time: Wed Dec 03 06:38:36 PST 2025

Total time taken to generate the page: 2.33142 seconds