Jump to content

StringRegExp help


Recommended Posts

This is the string:

Resursele pe knight world [1:265:8] (Jucator 'azumy'')

la 07-13 15:39:15

Metal: 106.129 Cristal: 27.219

Deuteriu: 8.028 Energie: 1.900

Total: 141376 Raid: 4

Flote

Transportor Mic 1

Aparare

Racheta Anti-Balistica 4

The bolded words never changes. I want to take out the underlined time. I've managed to do this using multiple StringSplits, but I want to do it using StringRegExp:

$y = "Resursele pe knight world [1:265:8] (Jucator 'azumy') la 07-13 15:39:15 Metal:    106.129     Cristal:    27.219 Deuteriu:    8.028   Energie:    1.900 Total:    141376  Raid:   4 Flote Transportor Mic 1 Aparare Racheta Anti-Balistica    4"

$1 = StringSplit($y, " la ", 1)
$2 = StringSplit($1[2], "Metal", 1)
$3 = StringSplit($2[1], " ", 1)

If @error == 0 Then
    MsgBox(0, "", $3[2])
EndIf

Any clue how? muttley

Link to comment
Share on other sites

Hi,

option 3 with this pattern \d\d:\d\d:\d\d

Mega

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

$y = "Resursele pe knight world [1:265:8] (Jucator 'azumy') la 07-13 15:39:15 Metal:    106.129     Cristal:    27.219 Deuteriu:    8.028   Energie:  1.900 Total:  141376    Raid:   4 Flote Transportor Mic 1 Aparare Racheta Anti-Balistica   4"
$p = StringREgExp($y, "(\d\d:\d\d:\d\d)", 3)
msgbox(0,"",$p[0])

That's just perfect! muttley But how does it know it should take 15:39:15 and not 1:265:8 ?

Link to comment
Share on other sites

$y = "Resursele pe knight world [1:265:8] (Jucator 'azumy') la 07-13 15:39:15 Metal:    106.129     Cristal:    27.219 Deuteriu:    8.028   Energie:  1.900 Total:  141376    Raid:   4 Flote Transportor Mic 1 Aparare Racheta Anti-Balistica   4"
$p = StringREgExp($y, "(\d\d:\d\d:\d\d)", 3)
msgbox(0,"",$p[0])

That's just perfect! muttley But how does it know it should take 15:39:15 and not 1:265:8 ?

Cause you tell it to do so. number number : number number : number number

thats not the same like number : number number number : number

Mega

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...