troubleshooting Question

javascirp regex to match a element has specefic url

Avatar of Afif JABADO
Afif JABADO asked on
Regular ExpressionsJavaScript
2 Comments2 Solutions53 ViewsLast Modified:
let say in the body element i have lot of a href i want to match <a> element
 <a between there is a lot of attribute originalsrc=\""

i want to match the first url from originalsrc that have ?rid !
and extract only first occurrence ..

Array [ "<a href=\"\" target=\"_blank\" rel=\"noopener noreferrer\" data-auth=\"Verified\" originalsrc=\"\" shash=\"kMreJEmsTtxFS9f7nFX5cQPqcvA2TBL0FMyGan0Nl6aLRiK/ue6Fx9QoIJavzhRzUBZN90yMTHMkljJ2bAuCqoHYscPId&#43;uMEVm6v9z98Dp0aTujspL8QpiN9Y1ktNjg5yZ9aqrDS718NIq3gXrqUIUP6Mc8m7ytQ/uFSGShLTQ=\" style=\"text-decoration:none\"></a>" ]

i want to get the originalsrc only if it contain ?rid=
Alex [***Alex140181***]
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros