I have text provided by the user and I need to add all backslashes and single quotes with backslashes. How to do it?
var string:String = "something 'is' \\fishy here"; trace(string);//something 'is' \fishy here string = string.replace(/(['\\])/g, "\\$1"); trace(string);//something \'is\' \\fishy here
Amarghosh's answer is this place. If you need an easy way to test the AS3 regex, Grant Skinner Regexr is awesome.
Source: https://habr.com/ru/post/1724223/More articles:To create a PDF page from MFC CView - pdfAny free button shapes available? - open-sourceDataMapper has n via Resource DELETE (Remove from association), does not work - ruby | fooobar.comget route name in ASP.NET MVC - asp.net-mvcwhat is the current use and future of the icon programming language - icon-languageHow to get my solutions in windows reports and solutions - windows-vistasql server 2005.mdf.ldf файлы - sqlИспользование 'mod_rewrite', как заставить HTTPS для определенных путей и HTTP для всех остальных? - apacheBlocked and Unblocked Popup - javascriptProgrammatically add Wi-Fi network to BlackBerry - apiAll Articles