Notifications
Clear all

[Closed] substituteString Ignore Case or Regex Replace?

Made a huge mistake in a couple of the scripts (variables are not written in same case and I need to iterate through all docs and a total row count of 20k)

Is there a way to ignore Case in substituteString ?
findstring & replace kills my 3dsmax, takes way to long time to execute it on a 4000 row script with about 1500 strings to look for.

If not then I guess im gonna have to go with Regex for speed or are there any other way to execute a string replacement as fast as substituteString?

I have tried the regex but I cant get the pattern to work on a multi line document to find the matches for the strings Im looking for. I only get the first word or the exact word
Ex spin Spinners spinning -> replace spin in all of these words

4 Replies
(
	str  = "spin Spinners spinning\n"
	str += "spin Spinners spinning\n"
	str += "spin Spinners spinning\n"
	
	regex   = dotnetClass "System.Text.RegularExpressions.Regex"
	pattern = "[sS]pin"
	str     = (dotnetObject regex pattern).Replace str "____"
	
	str
)

also other text editors are available

@PolyTools3D thank you works great in that example. Its not possible to use (?i) instead of [Ss] as its 1500 different str to look for and I dont know where the case is off?

@Klvnk Hahah yeah thats 100% true but Its easier for me to use mxs to obfuscate etc.

With a wrong description of a problem, you will always get a wrong solution, unless lucky is on your side.