On 6 Mar, 10:25, Nigel Wade <n...@[EMAIL PROTECTED]
> wrote:
> rlaybe...@[EMAIL PROTECTED]
wrote:
> > Hi
>
> > I am, trying to split an number of terms such as
str9=3Ddg_eyemouth.out
>
> > to take off the file extension
>
> > =A0print,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
reg=
ex
> 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


|