regexFind: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " |game1= arma3dev |version1= 2.05" to " |game1= arma3 |version1= 2.06") |
Lou Montana (talk | contribs) m (Text replacement - " |descr=" to " |branch= dev |descr=") |
||
Line 3: | Line 3: | ||
|game1= arma3 | |game1= arma3 | ||
|version1= 2.06 | |version1= 2.06 | ||
|branch= dev | |||
|descr= Returns all all matches found with given ''pattern'' in given ''haystack'' and their offset. | |descr= Returns all all matches found with given ''pattern'' in given ''haystack'' and their offset. |
Revision as of 13:16, 21 May 2021
Description
- Description:
- Returns all all matches found with given pattern in given haystack and their offset.
- Groups:
- Regular Expression (Regex)
Syntax
- Syntax:
- haystack regexFind [pattern, startOffset]
- Parameters:
- haystack: String
- pattern: String - Format regex pattern
- offset: Number - (Optional, default: 0) The offset has to be smaller then
count haystack
and>= 0
- Return Value:
- Array of arrays. Each array in format:
Examples
- Example 1:
"wooKie boOkie cookie" regexFind [".ookie/gio"]; // [["wooKie",0],["boOkie",7],["cookie",14]]
- Example 2:
"wooKie boOkie cookie" regexFind [".ookie/i"]; // [["wooKie",0]]
- Example 3:
"wooKie boOkie cookie" regexFind [".ookie/"]; // [["wooKie",0],["boOkie",7],["cookie",14]]
- Example 4:
- Multiline example:
"co1kie2 co2kie" regexFind ["^co.kie$"]; // [["co1kie",0],["co2kie",8]]
- Example 5:
"I'm a cookie clicker" regexFind ["c(.*?)k(.*?)e/i"]; // [["cookie",6],["oo",7],["i",10]]
- Example 6:
"I'm a cookie clicker" regexFind ["c(.*?)k(.*?)e"]; // [["cookie",6],["oo",7],["i",10],["clicke",13],["lic",14],["",18]]
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