ExtractRegularExpression splits strings incorrect.
Posted: Mon Mar 25, 2013 2:33 pm
http://www.purebasic.fr/english/viewtop ... 18#p409018
Commenting this linked topic, I tried some RegularExpression like shown below and in the helpfile url : http://www.pcre.org/pcre.txt
Shouldn't the ExtractRegularExpression() split the string into words instead of single characters with the \w expression ?
It looks like text can only be split in single characters not in words, while \w and \W really stands for words imo.
Thanks
Commenting this linked topic, I tried some RegularExpression like shown below and in the helpfile url : http://www.pcre.org/pcre.txt
Shouldn't the ExtractRegularExpression() split the string into words instead of single characters with the \w expression ?
Try the source below with \w or \W and \s or \S , which imo should do the opposite between lower and upper case of the expression.Another use of backslash is for specifying generic character types:
\d any decimal digit
\D any character that is not a decimal digit
\h any horizontal white space character
\H any character that is not a horizontal white space character
\s any white space character
\S any character that is not a white space character
\v any vertical white space character
\V any character that is not a vertical white space character
\w any "word" character
\W any "non-word" character
It looks like text can only be split in single characters not in words, while \w and \W really stands for words imo.
Code: Select all
If CreateRegularExpression(0, "\w",#PB_RegularExpression_DotAll)
Dim Result$(0)
NbFound = ExtractRegularExpression(0, "abC ABc zbA abc", Result$())
Debug NbFound
For k = 0 To NbFound-1
Debug Result$(k)
Next
Else
Debug RegularExpressionError()
EndIf