AgkBrian 0 Posted September 1, 2011 Hello, so im trying to put together a regular expression to grab some variables from input fields on a website. Here is what the code on the website looks like: <form id="activation" method="post" action="" > <h1 class="title">Information</h1> <div class="input2"> <h2>code:</h2> <input type="text" name="" value="rtx3g3" class="textfield" readonly /> </div> <div class="input2"> <h2>Password:</h2> <input type="text" name="" value="q4KDL" class="textfield" readonly /> </div> </form> Ive tried using the following to get the value field from the code $result = StringRegExp($HTML, 'value="([a-zA-Z0-9]+)"', 1) I'm pretty new to regular expressions so if there is a better way to do it let me know. I don't know if there will always only be 6 characters, so this was just a guess, but since it isnt giving me anything, i figure i did something wrong. Since there is more than one instance of the value on the page, it will put both instances of the value into an array correct? Share this post Link to post Share on other sites
UEZ 1,298 Posted September 1, 2011 (edited) Try this: $aResult = StringRegExp($HTML, '(?i)value="(.*)" class.*', 3) _ArrayDisplay($aResult) Br, UEZ Edited September 1, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
AgkBrian 0 Posted September 1, 2011 Thanks, tried what you posted, but it doesn't quite work. I threw out a message box at the end and $aResult equals 1 if i try to put in $aResult[0] it tells me that $aResult isnt an array. Share this post Link to post Share on other sites
UEZ 1,298 Posted September 1, 2011 I put the html code from your 1st post to test.html #include <Array.au3> $html = FileRead(@ScriptDir & "\test.html") $aResult = StringRegExp($HTML, '(?i)value="(.*)" class.*', 3) If Not @error Then _ArrayDisplay($aResult) The result are 2 values. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
AgkBrian 0 Posted September 1, 2011 Great for the help! Share this post Link to post Share on other sites