wilbert wrote:Joris wrote:This one I found but haven't test it yet : ExtractRegularExpression(#RegularExpression, String$, Array$()) must be useful for split.
It looks interesting but I haven't got a clue what the proper expression would be to split a string.
Also I don't know how fast it is.
Hm, good question. I got stuck on that...
Now more on what kind of RegularExpression can be used, as there are a lot and I don't know if all have the same definition. I thougth Perl is a language with the most possible RegularExpression, the base for the RegularExpression in PB I don't know (we must ask or find out).
Here are some RegularExpression I can use in my editor (UltraEdit) :
% Matches the start of line - Indicates the search string must be at the beginning of a line but does not include any line terminator characters in the resulting string selected.
$ Matches the end of line - Indicates the search string must be at the end of line but does not include any line terminator characters in the resulting string selected.
? Matches any single character except newline.
* Matches any number of occurrences of any character except newline.
+ Matches one or more of the preceding character/expression. At least one occurrence of the character must be found. Does not match repeated newlines.
++ Matches the preceding character/expression zero or more times. Does not match repeated newlines.
^b Matches a page break.
^p Matches a newline (CR/LF) (paragraph) (DOS Files)
^r Matches a newline (CR Only) (paragraph) (MAC Files)
^n Matches a newline (LF Only) (paragraph) (UNIX Files)
^t Matches a tab character
[xyz] A character set. Matches any characters between brackets.
[~xyz] A negative character set. Matches any characters NOT between brackets including newline characters.
^{A^}^{B^} Matches expression A OR B
^ Overrides the following regular expression character
^(…^) Brackets or tags an expression to use in the replace command. A regular expression may have up to 9 tagged expressions, numbered according to their order in the regular expression.
The corresponding replacement expression is ^x, for x in the range 1-9. Example: If ^(h*o^) ^(f*s^) matches "hello folks", ^2 ^1 would replace it with "folks hello".
Added a few more so maybe easier to find the equivalents in PB (already tried some like \w and ... not compatible) :
Code: Select all
\ Indicates the next character has a special meaning. "n" on it’s own matches the character "n". "\n" matches a linefeed or newline character. See examples below (\d, \f, \n etc).
^ Matches/anchors the beginning of line.
$ Matches/anchors the end of line.
* Matches the preceding character zero or more times.
+ Matches the preceding character one or more times. Does not match repeated newlines.
. Matches any single character except a newline character. Does not match repeated newlines. (expression)
Brackets or tags an expression to use in the replace command. A regular expression may have up to 9 tagged expressions, numbered according to their order in the regular expression.
The corresponding replacement expression is \x, for x in the range 1-9. Example: If (h.*o) (f.*s) matches "hello folks", \2 \1 would replace it with "folks hello".
[xyz] A character set. Matches any characters between brackets.
[^xyz] A negative character set. Matches any characters NOT between brackets including newline characters.
\d Matches a digit character. Equivalent to [0-9].
\D Matches a nondigit character. Equivalent to [^0-9].
\f Matches a form-feed character.
\n Matches a linefeed character.
\r Matches a carriage return character.
\s Matches any whitespace including space, tab, form-feed, etc but not newline.
\S Matches any non-whitespace character but not newline.
\t Matches a tab character.
\v Matches a vertical tab character.
\w Matches any word character including underscore.
\W Matches any nonword character.
\p Matches CR/LF (same as \r\n) to match a DOS line terminator.
Sometimes it's a bit searching to combine the right one but mostly they are very useful.
I just see the RegularExpression for PB are explained here :
http://www.pcre.org/pcre.txt
Quit a bunch to explore...