Jump to content

StringRegEx Question


Recommended Posts

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
Link to comment
Share on other sites

$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

Link to comment
Share on other sites

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])
Link to comment
Share on other sites

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...