Code: Select all
MsgBox % "literal: " SubStrCt("1+1 1+2 1+1 111", "1+1") ; missing paramater #3 for literal matching
. "`nRegEx: " SubStrCt("1+1 1+2 1+1 111", "1+1", 1) ; paramater #3 = 1 or true for RegEx matching
Return
SubStrCt(Haystack, String, RegexPattern := false) {
RegExReplace(Haystack, (RegexPattern ? "" : "\Q") . String . (RegexPattern ? "" : "\E"),, ChrCt) ; Case sensitive!
Return ChrCt
}
The string is via inputbox OR by variable and I need both to work case-insensitively for literal matching.
Your help would be much appreciated!