MAXScript find and remove specified string from text file


#1

How to remove all the text between the characters /* and */ (including these characters as well) in a text file? I need this to clear the code text of any comment lines. Thank you.


#2

you can use these patterns combined with (dotNetClass “System.Text.RegularExpressions.RegEx”).Replace to remove the comments

local block_comment = "\/\*(\*(?!\/)|[^*])*\*\/\r*\n*"
local line_comment  = "(--[^\r\n]*\r*\n*)"

#3

This works great, thanks!