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

Home » Public Forums » archive » Stregex question - extracting substring
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: Stregex question - extracting substring [message #87010 is a reply to message #87008] Thu, 19 December 2013 13:09 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Thursday, December 19, 2013 9:53:08 PM UTC+1, John Correira wrote:
> On 12/19/2013 03:44 PM, Paul Mallas wrote:
>
>> I am trying to extract a substring after a colon. My string looks
>
>> like:
>
>>
>
>> xxxxxx:yyyyyyyyy
>
>>
>
>> where x's can be spaces, upper and lower case letters
>
>>
>
>> then there's the colon
>
>>
>
>> and finally the y's, which can be pretty much anything and will often
>
>> include colons (which is why strsplit("xxxxxx:yyyyyyyyy", ":") won't
>
>> work for me here)
>
>>
>
>> I just want the yyyyyyyyyy part and have been trying to extract it
>
>> with stregex, but no luck. But before I give up and will try a
>
>> different approach, does anyone know how to construct a regular
>
>> expression for IDL that would extract just the yyyy.. part with
>
>> stregex?
>
>>
>
>> Thanks for your time.
>
>>
>
>
>
>
>
> Not a stregex solution, but I think something like
>
>
>
> strjoin((strsplit(string,':',/extract))[1:*],':')
>
>
>
> would do it.
>
>
>
> John

Hi John
I just answered and the original post was deleted, so my answer was dumped.
My solution was: strmid(str,strpos(str,':')+1)
It's good as long as there is at least one ':'. (if necessary one can check for it...).

Cheers,
h
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL 8.3 released
Next Topic: Problems with Retain on OS X Mavericks

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

Current Time: Fri Nov 28 14:33:34 PST 2025

Total time taken to generate the page: 0.88648 seconds