Regex. No classes between [].

Just starting out? Need help? Post your questions and find answers here.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

IIRC they only work within a character class (so inside another []). This works:

Code: Select all

If CreateRegularExpression(0, "[[:alpha:]]")

  Debug MatchRegularExpression(0, "a")
  Debug MatchRegularExpression(0, "1")

  FreeRegularExpression(0)
Else
  Debug "Error: " + RegularExpressionError()
EndIf
Try the RegularExpressionError() if something isn't working as you expect, it is there to tell you why ;)

btw, PB uses the PCRE library (BSD license). The documentation can be found here: http://www.pcre.org/pcre.txt
quidquid Latine dictum sit altum videtur
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

Cool. Thanks for the fast answer.

Best regards

Wolf
Post Reply