javascript regex in chrome extension -
javascript regex in chrome extension -
okay, little context. want modify crappy html on page utilize lot. i'm doing via content_script "js", defined in manifest.json file of chrome extension. primary method i've been using sort of ugly thing:
var str1 = 'something on page'; var str2 = 'something on page, plus stuff'; document.body.innerhtml = document.body.innerhtml.replace(str,st2); i'm trying re-order form objects, , expand them little show more information, , filter/condense them less superfluous. i'd appreciate pointer improve way this.
anyway... here's specific problem.
i want retrieve pistol (or string) following:
<form action="map.cgi?use-o" method="post" class="a"><input type="submit" value="pistol" class="m"\></form> i tried every variation of following:
str.exec(/value="([^]+)" class/); and i'm either getting null or junk strings don't want. ideas?
thanks!
if insist on regex, utilize below one:
(?:value=")([^"]+) here demo
using javascript like:
var value = document.queryselectorall("input[type=submit]")[0].value; javascript regex google-chrome
Comments
Post a Comment