| QFree 2.1 → Regex commands | |
QF_REExtractText
| QF_REExtractText(patternText; targetText; groupsToExtract; extractedMatches; regexFlags):result | |||
| | patternText | Text | Regular expression |
| | targetText | Text | Target text |
| | groupsToExtract | Text | Group numbers to extract |
| | extractedMatches | Array text | Array of extracted segments |
| | regexFlags | Longint | Regular expression flags |
| | error | Longint | Error result |
Extracts all matches of a regular expression against a text variable.
Parameter patternText is the regular expression to be matched.
Parameter targetText is the target text variable.
Parameter groupsToExtract specifies the groups to be extracted. If it is empty or "0", only the whole pattern matches are extracted. If the pattern contains grouping parentheses, the groupsToExtract can be a list of group numbers to be extracted. For example, by specifing "2 1", all matches of the second and first sub-pattern will be extracted in the specified order. QFree uses the "\d+" pattern internally to extract the group numbers from the groupsToExtract string.
Parameter extractedMatches receives the pattern matches. Depending on the groups specified in groupsToExtract, this parameters can be:
- 1-dimension text array, if groupsToExtract specifies a single group
- 2-dimension text array, if groupsToExtract specifies a list of groups

