FindStrRegex
|
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
FindStrRegex( value, find, [start], [numResults] )
find_str_regex( value, find, [start], [numResults] )
FindStrRegex( value, find, [start], [numResults] )
FindStrRegex( value, find, [start], [numResults] )
FindStrRegex( value, find, [start], [numResults] )
FindStrRegex( value, find, [start], [numResults] )
Description
The FindStrRegex function returns an array of up to 1,024 objects that
describe where the pattern is found in the search string.
Parameters
| Parameter | Type | Definition and Requirements | ||
|---|---|---|---|---|
|
String |
The string to search in. |
||
|
String |
The Java-compatible regular expression pattern to find in the value string. |
||
|
Integer |
Optional - The offset into the search string in characters of where
the search should start. The default value, if omitted, is 0 code
points. The first position in the string is 0. If the value is less
than 0, then
|
||
|
Integer |
Optional - The number of matches to find in the search string. The default is 1,024 and the maximum is 1,024. |
Returns
An array of objects where each object contains the details of a match, including the start position, end position, and the sub-string that was matched.
Examples
-
The following query searches the string
ABC abc ABCfor the pattern[Bb], which matches the letterBor the letterb. The result is an array of the three matches that exist, with each match reporting the start and end positions of the match, and the actual sub-string that matched:[ { start: 1, end: 1, data: 'B' }, { start: 5, end: 5, data: 'b' }, { start: 9, end: 9, data: 'B' } ][{'start': 1, 'end': 1, 'data': 'B'}, {'start': 5, 'end': 5, 'data': 'b'}, {'start': 9, 'end': 9, 'data': 'B'}][map[data:B end:1 start:1] map[data:b end:5 start:5] map[data:B end:9 start:9]]Arr(ObjectV(start: LongV(1),end: LongV(1),data: StringV(B)), ObjectV(start: LongV(5),end: LongV(5),data: StringV(b)), ObjectV(start: LongV(9),end: LongV(9),data: StringV(B)))[{start: 1, end: 1, data: "B"}, {start: 5, end: 5, data: "b"}, {start: 9, end: 9, data: "B"}][ { start: 1, end: 1, data: 'B' }, { start: 5, end: 5, data: 'b' }, { start: 9, end: 9, data: 'B' } ] -
The following query uses the same
valuestring andfindpattern as the previous example, but it also specifies astartposition. The start position is far enough into thevaluestring that there are only two matches in the result:[ { start: 5, end: 5, data: 'b' }, { start: 9, end: 9, data: 'B' } ][{'start': 5, 'end': 5, 'data': 'b'}, {'start': 9, 'end': 9, 'data': 'B'}][map[data:b end:5 start:5] map[data:B end:9 start:9]]Arr(ObjectV(start: LongV(5),end: LongV(5),data: StringV(b)), ObjectV(start: LongV(9),end: LongV(9),data: StringV(B)))[{start: 5, end: 5, data: "b"}, {start: 9, end: 9, data: "B"}][ { start: 5, end: 5, data: 'b' }, { start: 9, end: 9, data: 'B' } ] -
The following query uses the same
valuestring,findpattern, andstartposition as the previous example, but it also specifies anumResultslimit. The limit restricts the number of results to one:[ { start: 5, end: 5, data: 'b' } ][{'start': 5, 'end': 5, 'data': 'b'}][map[data:b end:5 start:5]]Arr(ObjectV(start: LongV(5),end: LongV(5),data: StringV(b)))[{start: 5, end: 5, data: "b"}][ { start: 5, end: 5, data: 'b' } ]