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.
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

value

String

The string to search in.

find

String

The Java regex pattern to find in the value string.

start

Integer

Optional - The offset into the search string in characters 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.

Although we mention characters, technically, we are talking about code points. In Unicode, a code point is usually but not always a character. Code points can sometimes represent single characters, but can also represent formatting and other non-alphanumeric characters.

For example, the character é can be the single character "e" that includes an acute accent (U+00E9), or it could be displayed as a single character but be composed of an "e" (U+0065) and a "combining" acute accent (U+0301). Visually, you cannot distinguish between the two.

max_Results

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.

Not available in this language yet.
Not available in this language yet.
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"}]
]
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!