FindStrRegex
Not available in this language yet.
FindStrRegex( value, find, [start], [numResults] )
FindStrRegex( value, find, [start], [numResults] )
FindStrRegex( value, find, [start], [numResults] )
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
FindStrRegex( value, find, [start], [numResults] )
Description
The FindStrRegex
function returns an array of up to 1024 objects
describing where the pattern is found in the search string.
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
String |
The string to search in. |
|
String |
The Java regex pattern to find in the value string. |
|
Integer |
Optional - The offset into the search string in code points of where the search will 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 the start value is ignored. |
|
Integer |
Optional - The maximum number of results to find in the search string. The default is 1024 and the maximum is 1024. |
Returns
An array of objects which contains the start position, the end position, and the data which was matched.
Examples
The query below executes an array of independent FindStrRegex
operations and returns the results in an array. The result array
position matches the execution array position. The first operation takes
a string to search ("fire and Fireman") and locates the first occurrence
of the pattern string "fire". The resultant object is placed in the top
position of the result array. For each occurrence found, an object
containing the start position, the end position, and the data matched is
returned. The second operation uses the same search string ("fire and
Fireman") and attempts to locate the first occurrence of the pattern
"[Ff]ire" in the string. An array of two results is placed in the second
position of the result array.
System.out.println(
client.query(
Arr(
FindStrRegex("fire and Fireman", "fire"),
FindStrRegex("fire and Fireman", "[Ff]ire")
)
).get());
[
[{start: 0, end: 3, data: "fire"}],
[{start: 0, end: 3, data: "fire"}, {start: 9, end: 12, data: "Fire"}]
]
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
documentation@fauna.com
Thank you for your feedback!