Jump to content

I'm really stupid and can't figure out StringRegExp


 Share

Recommended Posts

I have a String that I'm trying to get the text between of.

The string is something like

 

user/Dgameman1" class="author

 

I'm trying to get everything between user/ and " class="author

This is the code I currently have 

StringRegExp($HTML,'(\/user\/)(.+?)(\" class)', 3)

But for whatever reason, this isn't returning the value and I'm not sure how to go about fixing the Regex Expression.

 

Thank you guys so much

Edited by Dgameman1
Link to comment
Share on other sites

$s = 'user/Dgameman1" class="author'

msgbox(0 , '' , stringregexp($s , 'user\/(.*?)\" class' , 3)[0])

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

I guess that's not the only thing wrong with my code then.

This is what I have so far

#include <IE.au3>

$Texans = _IECreate("https://www.reddit.com/r/texans", 0, 1, 1)

$TexansHTML = _IEDocReadHTML($Texans)

$TexansUsernames = StringRegExp($TexansHTML,'user\/(.*?)\" class', 3)
MsgBox(1,"lol",$TexansUsernames[0])
;_IEQuit($Texans)

 

I don't just get what's in between the user and the class

Link to comment
Share on other sites

close, no need for class

#include <IE.au3>
#include <array.au3>

$Texans = _IECreate("http://www.reddit.com/r/texans", 0, 0, 1)

$TexansHTML = _IEDocReadHTML($Texans)

_IEQuit($Texans)

$TexansUsernames = StringRegExp($TexansHTML,'user\/(.*?)\"', 3)
_ArrayDisplay($TexansUsernames)

 

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...