Initializing help system before first use

# regmatch

Purpose
Compare text strings using a regular expression.
Synopsis
`function regmatch(src:text, regex:string):boolean`
`function regmatch(src:text, regex:string, start:integer, flags:integer):boolean`
`function regmatch(src:text, regex:string, start:integer, flags:integer, mp:array(range) of textarea):boolean`
Arguments

src | Text to process
regex | Regular expression
start | Position where to start the search
flags | Search options:
REG_EXTENDED | Use Extended Regular Expression syntax (ERE), default is to interpret the expression as a Basic Regular Expression (BRE)
REG_ICASE | Comparison is performed case insensitive (by default it is case sensitive)
REG_NEWLINE | The character newline ( \n) is treated as the end of line (by default it is handled as an ordinary symbol)
REG_NOTBOL | The beginning of the text string is not the beginning of a line
REG_NOTEOL | The end of the text string is not the end of a line
mp | Matching regions as an array of text area objects

Return value
true if a match was found.
Example
The following example extracts the value of 'pars2' from an input text consisting of lines of the form name=value:

    declarations
     m:array(range) of textarea
     t:text
    end-declarations

    t:="p1=10\npars2=234\nparam9=56\n"
    if regmatch(t,'pars2=\(.*\)$',1,REG_NEWLINE,m) then
     pars2:=parseint(t,m(1))
     writeln(pars2)
    end-if

Further information
1. This function relies on the TRE library (see https://github.com/laurikari/tre). Please refer to the documentation of this library for a detailed description of the supported expression syntax.
2. When the mp argument is provided and the search is successful, the result of the processing is returned via this array as textarea objects (see Section The type textarea): the array cell 0 refers to the entire matching region and the following ones to each of the subexpressions.
Related topics
findtext, pathmatch, regreplace, sys_regcache
Module
mmsystem
Parent Topic Procedures and functions

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.