I have an regular expression built in Java.
String expr = "<a.*?id=\"(pres.*?)\".*?>Discharge.*?Medications:</a>";
I want to use same regular expression in Javascript.
Will it be different or same?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I suggest you don’t do it.
Why? I will just point you out to one of the most upvoted answer on StackOverflow: https://stackoverflow.com/a/1732454/851498
In javascript, you’d better use the DOM than a regex to parse HTML.
Example:
Or if you’re using jQuery:
I didn’t code the last part, but you get the idea. Using a regex on
$( this ).text()would be fine, it’s not HTML.