MAXScript find and remove specified string from text file


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.


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*)"


This works great, thanks!