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

Home » Public Forums » archive » stregex fails to match underscore
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 fails to match underscore [message #88229 is a reply to message #88228] Mon, 31 March 2014 13:23 Go to previous messageGo to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Monday, March 31, 2014 10:12:46 PM UTC+2, Paul Mallas wrote:
> I am trying to use stregex to match a filename. I am curious why, after the
>
> '([LLC|KGD|GFC|FFC])' portion of my search string, the first '_' does not match.
>
> For example:
>
> name = 'GDP1_XXX__KGD_RF.xml'
> searchStr = '^G[DS]P1_XXX__([LLC|KGD|GFC|FFC])'
> print, stregex(name, searchStr, /boolean) ; Match
>
> searchStr = '^G[DS]P1_XXX__([LLC|KGD|GFC|FFC])_'
> print, stregex(name, searchStr, /boolean) ; Not Match
>
> Not sure why this happens. Anyone have any ideas?

([LLC|KGD|GFC|FFC]) matches a single character. Omit the brackets:

searchStr = '^G[DS]P1_XXX__(LLC|KGD|GFC|FFC)_'

regards,
Lajos
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: check if other routine is accessing a text file
Next Topic: float function unexpectedly slow

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

Current Time: Wed Oct 08 18:11:21 PDT 2025

Total time taken to generate the page: 0.00396 seconds