Name

regexptokenize — Regex tokenize

Synopsis

list regexptokenize ( string INPUT ,
  string PATTERN );
 

Parameters

string INPUT

string PATTERN

Return

list

Description

Searches a string for a POSIX Extended Regular Expression match and returns a list of the matched subexpressions

If the pattern does not match, the list is empty. Otherwise the list contains then matchted subexpressions for each pair of parenthesize in pattern.

If the pattern is invalid, 'nil' is returned.

Usage

 
 Examples:
 // e ==  [ "aaabbB" ]
 list e = regexptokenize ("aaabbBb", "(.*[A-Z]).*");
 
 // h == [ "aaab", "bb" ]
 list h = regexptokenize ("aaabbb", "(.*ab)(.*)");
 
 // h == []
 list h = regexptokenize ("aaabbb", "(.*ba).*");
 
 // h == nil
 list h = regexptokenize ("aaabbb", "(.*ba).*(");