in reply to Bug in script, regex help req extreme urgent

Why do you use the /s modifier of the substitution? It makes . match a newline which is the reason of your problem. Is it possible in your input file for module to be separated by a newline from the module name or arguments?
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ