我正在使用正则表达式来提取>
和<
之间的特定单词:
Example : >my name is Dany<
oldName - Dany
newName - John
var newXML = orgData.replace(new RegExp(`(?<=>)(.*${oldName})(?=<\/)`, 'g'), newName)
它可以在Windows上运行,但在Mac上会引发以下错误:
var newXML = orgData.replace(new RegExp(`(?<=>)(.*${oldAppName})(?=<\/)`, 'g'), newAppName)
^
SyntaxError: Invalid regular expression: /(?<=>)(.*Dany)(?=</)/: Invalid group