Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > Re: quick strsp...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 5510 of 6454
Post > Topic >>

Re: quick strsplit question

by rlayberry@[EMAIL PROTECTED] Mar 7, 2008 at 05:56 AM

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
 




 4 Posts in Topic:
quick strsplit question
rlayberry@[EMAIL PROTECTE  2008-03-06 01:47:34 
Re: quick strsplit question
Spon <christoph.blau@[  2008-03-06 02:07:42 
Re: quick strsplit question
Nigel Wade <nmw@[EMAIL  2008-03-06 10:25:50 
Re: quick strsplit question
rlayberry@[EMAIL PROTECTE  2008-03-07 05:56:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 14:28:50 CST 2008.