forked from Masonjar13/AHK-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
regExReplaceI.ahk
37 lines (25 loc) · 913 Bytes
/
regExReplaceI.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* Written by Masonjar13
String-inverted RegExReplace. Useful if you know it will match towards the end
of a large string.
Dependencies:
strI()
-----------------
Parameters:
---------------
haystack: string to search
needleRegEx: regex to use
replacement (optional): replacement text
byRef outputVarCount (optional): variable to store found count
limit (optional): maximum replacements allowed
startingPosition (optional): string position to start at
return: string after replacement
---------------
Example:
------------
foundStr:=regExReplaceI("Hello World","[A-Z]","M")
msgbox % foundStr "`n" strI(foundStr)
------------
*/
regExReplaceI(haystack,needleRegEx,replacement:="",byref outputVarCount:="",limit:=-1,startingPosition:=1){
return strI(regExReplace(strI(haystack),needleRegEx,replacement,outputVarCount,limit,startingPosition))
}