Splitting a Text Using a Pattern
Previous  Top  Next



NOTE: splitting is not supported natively by PCRE: it is instead a feature provided by the Delphi wrappers.



To split a text using a pattern

·Type the pattern in the Pattern Edit Box and set any relevant compile options as described in Compiling a Pattern  
·Type the text you want to be split the Text To Grep Edit Box  
·Set any appropriate Search Options  
·Check INCLUDE SEPARATORS if you want the matched separators to also be included in the token list  
·Press the Split Button  

split  


NOTES

 
1.If capture groups are present in the pattern, the captured groups are included in the token list  
(ex: see what it happens if you use the following pattern ([^[:alnum:]]+)  
 
2.   If a string is split at the first or the last position an empty string is included in the token list. We can see that in the screen shot: given the string 'green.' the pattern [^[:alnum:]]+ matches the last dot and therefore splits the string into the two tokens 'green' and ''