0

I am using regex in python to find <span class="dlog"...>Whatever you want to put here</span>, and have been using pythex and crossreferencing regexpal to match the case. However, inside of my javascript file, where I am defining a variable containing the regex, as follows:

    var tokenRe = /<span class=\"dlog\"(.*?)\>(.*?)\</span>/;

I am getting an error: SyntaxError: Invalid regular expression: missing /. Thus, I need help trying to implement this regex inside of my javascript file.

Thanks !

2

1 Answer 1

3

You did not escape the slash for </span. You also don't need so many escapes because of the regex literals:

var tokenRe = /<span class="dlog"(.*?)>(.*?)<\/span>/
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.