Jump to content
Sign in to follow this  
MaxMeyer123

StringRegEx Question

Recommended Posts

MaxMeyer123

Hi guys, currently im writing an really simple api for pyload.

For one function i wanna see how much parts are left.

 
<label style="font-size: 0.8em; font-weight: bold; padding-left: 5px; position: relative; top: -17px">
        800.00 MiB / 33.66 GiB</label>

800MB downloaded from 33,66 GB

How can i use StringRegEx if theres more then 1 line?

Sorry for my bad english

Ty guys

Edited by MaxMeyer123

Share this post


Link to post
Share on other sites
Xenobiologist

$str = '<label style="font-size: 0.8em; font-weight: bold; padding-left: 5px; position: relative; top: -17px">' & @CRLF & _
        '800.00 MiB / 33.66 GiB</label>'

$re = StringRegExp($str, '\d+\.\d*\s*\w+\s*\/\s*\d+\.\d*\s*\w+', 3)
ConsoleWrite($re[0] & @CRLF)

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
MaxMeyer123

wuut :D 

its as include for my pyload script, the html source code contains like 500 lines :S i thought to something like this but i get error 

$GBArr = StringRegExp($sPaket,'<label style="font-size: 0.8em; font-weight: bold; padding-left: 5px; position: relative; top: -17px">[\r\n]+[ ]+(\d+) / (\d+)</label>',3)

but i get 

"C:UsersKNG HOLDYDesktop_FB_Tools 1.5includesPyload_Selfmade.au3" (94) : ==> Subscript used on non-accessible variable.:
Msgbox(1, $GBArr[0], $GBArr[1])
Msgbox(1, $GBArr^ ERROR
 
if i wanna call it with
Msgbox(1, $GBArr[0], $GBArr[1])

Share this post


Link to post
Share on other sites
Xenobiologist

If your pattern doesn't match, then your variable will not be an array --> error.

You can check with isArray or check the @error value.

500 lines is no problem. Will take only some ms.


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
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
Sign in to follow this  

×