4D v14.3Match regex |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
Match regex
Match regex
The Match regex command checks the conformity of a character string with respect to a set of synthesized rules by means of a meta-language called “regular expression” or “rational expression.” The regex abbreviation is commonly used to indicate these types of notations. Pass the regular expression to search for in pattern. This consists of a set of characters used for describing a character string, using special characters. Pass the string where you want to search for the regular expression in aString. In start, pass the position at which to start the search in aString. If pos_found and length_found are variables, the command returns the position and length of the occurrence in these variables. If you pass arrays, the command returns the position and length of the occurrence in the element zero of the arrays and the positions and lengths of the groups captured by the regular expression in the following elements. The optional * parameter indicates, when it is passed, that the search must be carried out at the position specified by start without searching any further in the case of failure. The command returns True if the search has found an occurrence. For more information about regex, refer to the following address: For more information about the syntax of the regular expression passed in the pattern parameter, refer to the following address: Search for complete equality (simple syntax): QUERY BY FORMULA([Employees];Match regex(".*smith.*";[Employees]name)) Search in text by position: Search with support of “capture groups” via parentheses. ( ) are used to specify groups in the regexes: ARRAY LONGINT(pos_found_array;0) Search limiting the comparison of the pattern to the position indicated: vfound:=Match regex("a.b";"---a-b---";1;$pos_found;$length_found) Note: The positions and lengths returned are only meaningful in Unicode mode or if the text being worked with is of the 7-bit ASCII type. In the event of an error, the command generates an error that you can intercept via a method installed by the ON ERR CALL command. In the event of an error, the command generates an error that you can intercept via a method installed by the ON ERR CALL command. |
PROPERTIES
Product: 4D
HISTORY
Created: 4D v11 SQL ARTICLE USAGE
4D Language Reference ( 4D v12.4) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||