全部正则表达式可以参照微软的文档

https://learn.microsoft.com/zh-cn/dotnet/standard/base-types/regular-expression-language-quick-reference

使用正则表达式查找和替换

有需要修改的代码是这个

想要在所有字符串前面加 u

winTitle='sdd_GenerateOptionEditor'
cmds.radioButtonGrp('goFlagRBG',e=1,sl=self.inputData['flagType'])
cmds.radioButtonGrp('goBoolRBG',e=1,sl=self.inputData['booleanType'])

我们需要搜索所有字符串就可以这样搜索

#搜索框
'.*?'

搜索结果就是

winTitle='sdd_GenerateOptionEditor'
cmds.radioButtonGrp('goFlagRBG',e=1,sl=self.inputData['flagType'])
cmds.radioButtonGrp('goBoolRBG',e=1,sl=self.inputData['booleanType'])

其中 ? 代表懒惰模式,搜索到符合条件的就会中断

如果去掉问号就不会中断结果就是

winTitle='sdd_GenerateOptionEditor'
cmds.radioButtonGrp('goFlagRBG',e=1,sl=self.inputData['flagType'])
cmds.radioButtonGrp('goBoolRBG',e=1,sl=self.inputData['booleanType'])

接下来要在字符串前面加 u

我们可以使用这个搜索和替换

#搜索框
'(.+?)'
#替换框
u'$1'

这段中的 $1 代表的是上面搜索中的第一个括号内的内容

执行后就可以输出

winTitle=u'sdd_GenerateOptionEditor'
cmds.radioButtonGrp(u'goFlagRBG',e=1,sl=self.inputData[u'flagType'])
cmds.radioButtonGrp(u'goBoolRBG',e=1,sl=self.inputData[u'booleanType'])