PtokaX forum

Development Section => Your Developing Problems => Topic started by: mOrrI on 07 November, 2003, 04:00:35

Title: Help to get a number from tag!!!
Post by: mOrrI on 07 November, 2003, 04:00:35
User: Testing    TAG: $MyINFO $ALL Testing dd<++ V:0.251,M:A,H:1/0/0,S:3,PT:1.0>$ $Cable$ddd$0 $8935101980367083748$

    User: Testing    TAG: $MyINFO $ALL Testing PTDC++ lite<++ V:0.25,M:A,H:1/0/0,S:3,PT:1.0>$ $Cable$$0 $8935101980367083748$?


the number in Red-Bold is the one i want to get :|

and i got these lines to get it... but i think this is not the way...  :))

     _,v,getshare = strfind(curUser.sMyInfoString,"$$(%d+)")

      _,v,nickname,getshare = strfind(curUser.sMyInfoString,"$(%w+)$(%d+)")

Title:
Post by: Guibs on 07 November, 2003, 04:56:32
Hi there,

mOrrI,,
I (& my script,, lol) love your client... :D

h? h? h?

> PT:1.0 <

loOol

I'm working on parsing,, at the moment,,...
But a ' normal' client should show:
-----
$MyINFO $ALL Tom_Sawyer $ $DSL$my mail$2229819$
-----
So,... your infos doesn't seems to be 'normal'... :s
-----
$Cable$ddd$0 $8935101980367083748$
-----
Btw,, maybe you could try:
-----
s,e,mysterious = strfind(data,"[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+[^$]+[^$]+([^$]+)")
-----
really not tested,... :p

Good luck,,

l8tr,, ;)
Title: heheh
Post by: mOrrI on 07 November, 2003, 19:33:13
s,e,mysterious = strfind(data,"[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+[^$]+[^$]+([^$]+)")


now this is what i want to learn...

how those that work, so that i can understand it :|


btw i will explain the client type later...
wasn't me who created it... :|
Title:
Post by: OpiumVolage on 07 November, 2003, 23:55:45
s,e,mysterious = strfind(data,"[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+[^$]+[^$]+([^$]+)")

How does it work?

this regex is saying find 1 or more "$" ([$]+) then find one or more non "$" ([^$]+ repeated 3 times. find 1 or more "$", find one or more non " or $" ([^$]+) find one or more non "$" then capture the folowings non "$".

Sick, and this is working ?

try with s, e, mysterious = strfind(data,"$ $[^$]+$[^$]*$(%d+)")

find first "$ $" string ($ space $) then one or more non "$" one "$" 0 or more non "$", one "$" and capture one or more digits.

And look here (http://www.lua.org/manual/4.0/manual.html#pm) to try understanding how it works.
Title: WOOt
Post by: mOrrI on 10 November, 2003, 00:49:43
many thanks to both...

but the 1st one didn't work ;)

and the:


s, e, mysterious = strfind(data,"$ $[^$]+$[^$]*$(%d+)")


WORKED ;)