IsRegExp command

Just starting out? Need help? Post your questions and find answers here.
normeus
Enthusiast
Enthusiast
Posts: 470
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: IsRegExp command

Post by normeus »

Please use @Didelphodon's excellent Rexman

It is written with PureBasic and it will give you the exact regex to use in PureBasic

so you can try different permutations of your code until you get it right. It even comes with a regex cheat sheet.



Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
User avatar
marcoagpinto
Addict
Addict
Posts: 1039
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: IsRegExp command

Post by marcoagpinto »

Hello!

I seemed to have fixed the prefixes decoding.

All I had to do was to add a "\b" to the beginning of the pattern and remove the $ from the end.

However, it gives a false positive if the word has a ' in it.

Code: Select all


    #RegularExpression=1

    a$="aster"
    b$="[^abehilmopru]."

    ; Try to match regular expression - 27/JAN/2019 + 28/JAN/2019 + 31/JAN/2019
    CreateRegularExpression(#RegularExpression,"\b"+b$,#PB_RegularExpression_DotAll)
    match=MatchRegularExpression(#RegularExpression,a$)
    FreeRegularExpression(#RegularExpression)
    Debug match
    
    
    
    
    a$="aster's"
    b$="[^abehilmopru]."    
    
    ; Try to match regular expression - 27/JAN/2019 + 28/JAN/2019 + 31/JAN/2019
    CreateRegularExpression(#RegularExpression,"\b"+b$,#PB_RegularExpression_DotAll)
    match=MatchRegularExpression(#RegularExpression,a$)
    FreeRegularExpression(#RegularExpression)
    Debug match    
    

How can I fix it?

Thanks!

Kind regards,

EDIT: It also triggers #True with a$="aster-s"
User avatar
marcoagpinto
Addict
Addict
Posts: 1039
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: IsRegExp command

Post by marcoagpinto »

Buaaaaaaaaaaaaaa....

I found the answer thanks to Microsoft Expression Web:
Image
Post Reply