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

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -