Difference between revisions of "regexFind"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (formatting)
m (Text replacement - "\|game([0-9]) ?= (.+) \|version([0-9]) ?= (.+) " to "|game$1= $2 |version$3= $4 ")
Line 2: Line 2:
|game1= arma3dev
|game1= arma3dev
|version1= 2.05
|version1= 2.05

Revision as of 15:52, 3 May 2021

-wrong parameter ("arma3dev") defined!-[[:Category:Introduced with arma3dev version 2.05|2.05]]
Hover & click on the images for description


Offsets are relative to haystack start, ignoring the provided startOffset. startOffset being <0 or >= count hayStack will trigger a script error and return empty array
Regular Expression (Regex)


haystack regexFind [pattern, startOffset]
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:
[[match1, offset1], [match2, offset2], ... [matchN, offsetN]]


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


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

[[Category:Introduced with arma3dev version 2.05]][[ Category: arma3dev: New Scripting Commands | REGEXFIND]][[ Category: arma3dev: Scripting Commands | REGEXFIND]]