ajRegExpCount function
Description
The ajRegExpCount function is used to match a string or statement to a regular expression (a sequence of characters that define a search pattern) and return the matched count.
Syntax
ajRegExpCount(input_string, pattern, [start_position], [ignore_case], [multi_line])
Argument Name | Description |
---|---|
input_string (required) | The range of cells to be set as the message to be searched. The range of cells can span across multiple rows and columns and it will be concatenated into a single string. It will concatenate the row first follow by the column. For example, Cell A1, “Hello ” Cell A2, “You” Cell B1, “I” Cell B2, “ Good” Concatenated result => “Hello YouI Good” |
pattern (required) | Specify the regular expression. It is based on “type of the regular repression standard” (i.e. Basic Regular Expressions (BRE) of the IEEE POSIX standard). |
start_position (optional) | Specify the starting search position of ‘Input_string’. 1 is the first position. If you do not specify anything, it will begin from the first position. |
ignore_case (optional) | TRUE for case insensitive search. FALSE for case sensitive search. If you do not specify anything, the default value will always be FALSE. |
multi_line (optional) | If it equals TRUE, and ‘Input_string’ has newline or carriage return characters, the ^ and $ operators will match against a newline boundary. If it equals FALSE, and ‘Input_string’ has newline or carriage return characters, the ^ and $ operators will match against a string boundary. If you do not specify anything, the default value will always be FALSE. |
The function will return:
1) Content type: Matched regular expression count
2) Method: Within a cell
Example
The regular expression below searches for a pattern that fulfils the following condition:
- the first and the second characters can be any character.
- the third character must be an alphabet.
- the fourth character must be "o"
- the fifth character must be an alphabet.
- the sixth and seventh characters can be any character.
3 matches were found in the input string.