#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)[`\\]|\${"
Local $sString = "// source https://stackoverflow.com/a/75688937/6404439" & @CRLF & _
"import React from 'react';" & @CRLF & _
"import SyntaxHighlighter from 'react-syntax-highlighter';" & @CRLF & _
"import { a11yDark } from 'react-syntax-highlighter/dist/esm/styles/hljs';" & @CRLF & _
"" & @CRLF & _
"const CodeBlock: React.FC<{ codestring: string }> = ({ codestring }) => {" & @CRLF & _
" return (" & @CRLF & _
" <SyntaxHighlighter" & @CRLF & _
" language="javascript"" & @CRLF & _
" style={a11yDark}" & @CRLF & _
" showLineNumbers>" & @CRLF & _
" {codestring}" & @CRLF & _
" </SyntaxHighlighter>" & @CRLF & _
" );" & @CRLF & _
"};" & @CRLF & _
"" & @CRLF & _
"function App() {" & @CRLF & _
"" & @CRLF & _
" var code = `function $initHighlight(block, cls) {" & @CRLF & _
" try {" & @CRLF & _
" if (cls.search(/\bno\-highlight\b/) != -1)" & @CRLF & _
" return process(block, true, 0x0F) +" & @CRLF & _
" \` class="\${cls}"\`;" & @CRLF & _
" } catch (e) {" & @CRLF & _
" /* handle exception */" & @CRLF & _
" }" & @CRLF & _
" for (var i = 0 / 2; i < classes.length; i++) {" & @CRLF & _
" if (checkCondition(classes[i]) === undefined)" & @CRLF & _
" return /\d+[\s/]/g;" & @CRLF & _
" }" & @CRLF & _
" return 0xA;" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" export $initHighlight;`;" & @CRLF & _
"" & @CRLF & _
" return (" & @CRLF & _
" <div className="w-1/2 bg-blue-700">" & @CRLF & _
" <CodeBlock codestring={code} />" & @CRLF & _
" </div>" & @CRLF & _
" );" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"export default App;"
Local $sSubst = "\\$&"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm