I’m encountering a weird bug where a regex works fine on desktop and in the editor, but kills the whole script on mobile.
Offending line:
$w(“#text449”).text = property.PublicRemarks.replace(/(?<!w{3})([.])(\S)(?!om|et|rg)/g, “$1\n\n$2”);
Essentially a third-party database removes newlines which makes reading the multi-paragraph description an eyesore. So I look for periods followed by a letter with no space and toss in a couple of newlines. This didn’t catch URLs, so I ignore any strings with .*om, .*et or .*rg. Sloppy? Sure. But get’s this particular job done.
It produces the following error in logs when I navigate to this dynamic page with the regex.
“LoadUserCodeError: Failed to import user code script: Script error. r@ @ @ @ @ reduce@[native code] u@ @ n@ Promise@[native code] @ u@ @ n@ Promise@[native code] @ @ u@ @ n@ Promise@[native code] @ @https://njvanhoff.wixsite.com/_partials/wix-thunderbolt/dist/clientWorker.8ac5a214.bundle.min.js:1:430072 generatorResume@[native code] @https://njvanhoff.wixsite.com/_partials/wix-thunderbolt/dist/clientWorker.8ac5a214.bundle.min.js:16:1282 Promise@[native code] s@https://njvanhoff.wixsite.com/_partials/wix-thunderbolt/dist/clientWorker.8ac5a214.bundle.min.js:16:1042 @https://njvanhoff.wixsite.com/_partials/wix-thunderbolt/dist/clientWorker.8ac5a214.bundle.min.js:1:237747 generatorResume@[native code] a@https://njvanhoff.wixsite.com/_partials/wix-thunderbolt/dist/clientWorker.8ac5a214.bundle.min.js:16:1084 promiseReactionJob@[native code]”
Thoughts? Thanks for your help!