I would like to convert this Ruby regex to JavaScript one:
/\<br \/\>\<a href\=(.*?)\>([0-9]+\:[0-9]+)\<\/a\> \<a href\=\'.*?\' target\=\_blank\>(.*?)(?=\<\/a\>\<br\>\<p.*?\<\/p\>\<br \/\>\<a href\=.*?\>([0-9]+\:[0-9]+)\<\/a\> \<a href\=\'.*?\' target\=\_blank\>.*?\<\/a\>.*?\<br \/\>)/m
It works perfectly in Ruby, but not in the Chrome JavaScript console. Then I will use it to extract some information from a webpage source HTML code (document.body.innerHTML
) with a JavaScript function using this scan
method described here: JavaScript equivalent of Ruby's String#scan
I think the lookahead (?= )
may be problematic in JavaScript, on the top of that it contains a capture group. Can it be converted at all?