{"ScriptPreparationCode":"var example = \u0022\\n\u2462\uFF1A\u53CD\u5E94\u2464\u7684\u5316\u5B66\u65B9\u7A0B\u5F0F\u662F\uFF1A\\n$$ \\\\text{C}_6\\\\text{H}_4(\\\\text{NO}_2)\\\\text{O}\\\\text{C}_2\\\\text{H}_5 \u002B 3\\\\text{Fe} \u002B 4\\\\text{H}_2\\\\text{O} \u002B \\\\text{HCl} \\\\rightarrow \\\\text{C}_6\\\\text{H}_4(\\\\text{NH}_2)\\\\text{O}\\\\text{C}_2\\\\text{H}_5 \u002B 3\\\\text{FeCl}_2}$$\\n\u2463\uFF1A\u83F2\u90A3\u897F\u6C40\u6C34\u89E3\u7684\u5316\u5B66\u65B9\u7A0B\u5F0F\u662F\uFF1A\\n$$ \\\\text{C}_6\\\\text{H}_4(\\\\text{NHCOCH}_3)\\\\text{O}\\\\text{C}_2\\\\text{H}_5 \u002B \\\\text{H}_2\\\\text{O} \\\\rightarrow \\\\text{C}_6\\\\text{H}_4(\\\\text{NH}_2)\\\\text{O}\\\\text{C}_2\\\\text{H}_5 \u002B \\\\text{CH}_3\\\\text{COOH}$$\u0022;","TestCases":[{"Name":"chain replace","Code":"example\r\n .replace(/\\\\([[(])\\n?/g, \u0022$$$1\u0022)\r\n .replace(/\\n?\\\\([)\\]])/g, \u0022$1$$\u0022)\r\n .replace(/log\\s([\\S]\u002B)/g, \u0022log_$1\u0022)\r\n .replace(/\\n/g, \u0022\u003Cbr/\u003E\u0022)\r\n .replace(/((\\${1,2})[^$]\u002B(\\2))/g, (...args) =\u003E {\r\n return (\r\n \u0022$\u0022 \u002B\r\n args[1]\r\n .replace(/\\${1,2}([^$]\u002B)\\${1,2}/g, \u0022$1\u0022)\r\n .trim()\r\n .replace(\u0022\u003Cbr/\u003E\u0022, \u0022\u0022) \u002B\r\n \u0022$\u0022\r\n );\r\n });","IsDeferred":false},{"Name":"chain replace\u0026split","Code":"var res = [];\r\nexample\r\n .replace(/\\\\([[(])\\n?/g, \u0022$$$1\u0022)\r\n .replace(/\\n?\\\\([)\\]])/g, \u0022$1$$\u0022)\r\n .replace(/log\\s([\\S]\u002B)/g, \u0022log_$1\u0022)\r\n .replace(/\\n/g, \u0022\u003Cbr/\u003E\u0022)\r\n .split(/((\\${1,2})[^$]\u002B(\\2))/g);\r\nres.map((item) =\u003E {\r\n return (\r\n \u0022$\u0022 \u002B\r\n item\r\n .replace(/\\${1,2}([^$]\u002B)\\${1,2}/g, \u0022$1\u0022)\r\n .trim()\r\n .replace(\u0022\u003Cbr/\u003E\u0022, \u0022\u0022) \u002B\r\n \u0022$\u0022\r\n );\r\n }).join(\u0027\u0027);","IsDeferred":false}]}