Jump to content
Sign in to follow this  
Kiti

StringRegExp help

Recommended Posts

Kiti

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

Share this post


Link to post
Share on other sites
Xenobiologist

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

Share this post


Link to post
Share on other sites
Kiti

$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 ?

Share this post


Link to post
Share on other sites
Xenobiologist

$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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.