skip to Main Content

regex goes Infinite loop for html attribute matching – Javascript

<(?<nodeName>[a-zA-Z][-a-zA-Z0-9_]*)(?<attributes>(?:s*[a-zA-Z_:!0-9,][-a-zA-Z0-9_:%."'`;(]*(?:s*=s*(?:(?:"[^"]*")|(?:'[^']*')|{{[^>}]*}}|[^>]+|w*))?)*)s*(/?)> This above regex trying to match the tagName and attributes. <span class='Utils.showtt("{{getI18n('zr.ratings.reviews.client.review.tag', getCrmModuleInfo('Accounts', 'true'))}}")'> but getting infinite loop since quotes mismatched in this input. Is there any way to throw error or prevent infinite loop.

VIEW QUESTION

Replace query strings – Javascript

I'm writing a code in Javascript where I wanted to replace all the query strings in a string of comma separated urls. But I'm able to do it only till some extent. Below is my code. const urls = '//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-2.psd?fmt=png-alpha&scl=1&hei=77&wid=92&qlt=100,1&resMode=sharp2&size=92,77&chrss=full,//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-4.psd?fmt=png-alpha&scl=1&hei=59&wid=92&qlt=100,1&resMode=sharp2&size=92,59&chrss=full,//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-6.psd?fmt=png-alpha&scl=1&hei=79&wid=92&qlt=100,1&resMode=sharp2&size=92,79&chrss=full,//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-7.psd?fmt=png-alpha&scl=1&hei=79&wid=92&qlt=100,1&resMode=sharp2&size=92,79&chrss=full,//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-8.psd?fmt=png-alpha&scl=1&hei=59&wid=92&qlt=100,1&resMode=sharp2&size=92,59&chrss=full,//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-9.psd?fmt=png-alpha&scl=1&hei=47&wid=92&qlt=100,1&resMode=sharp2&size=92,47&chrss=full,https://i.dell.com/das/dih.ashx/57x57/sites/csimages/Video_Imagery/all/lati-ys-video-thumbnail-hero-1280x720.jpg';…

VIEW QUESTION
Back To Top
Search