From Bohemia Interactive Community
Jump to navigation
Jump to search
Hover & click on the images for description
Description
- Description:
- Returns all matches found with given pattern in given haystack and their offset.
- Groups:
- Strings - Regular Expression
Syntax
- Syntax:
- haystack regexFind [pattern, startOffset]
- Parameters:
- haystack: String
- pattern: String - Format regex pattern
- offset: Number - (Optional, default: 0) has to be in range from 0 to
count haystack
(haystack length) - Return Value:
- Array of nested arrays. Each lowest level array in format:
- 0: String - Match
- 1: Number - Offset of given match relative to haystack beginning. Provided offset is ignored
Examples
- Example 1:
"wooKie boOkie cookie" regexFind [".ookie/gio"];
- Example 2:
"wooKie boOkie cookie" regexFind [".ookie/i"];
- Example 3:
"wooKie boOkie cookie" regexFind [".ookie/"];
- Example 4:
- Multiline example:
"co1kie2
co2kie" regexFind ["^co.kie$"];
- Example 5:
"I'm a cookie clicker" regexFind ["c(.*?)k(.*?)e/i"];
- Example 6:
"I'm a cookie clicker" regexFind ["c(.*?)k(.*?)e"];
Additional Information
- See also:
- regexMatch regexReplace
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here!
Add Note