Hi,
I have troubles with a script.
In this part of code I get a string value, but you know: I'm French and so, I will have many characters with accents and ponctuations.
CODE:
function Get2Args(data)
s,e,whoTo,from,cmd,arg,arg2= strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s+([%w%s]+)")
return arg,arg2
end
if (cmd=="!memo") then
arg,arg2 = Get2Args(data)
........ actions
end if
The problem is befoer the line s,e,whoTo,from,cmd,arg,arg2=str...., my string value keeps all of the accents and ponctuations, but after passed this line, the string value is troncated at the first met accent!!
For example:
if I send the string "le niveau sup?rieur de grade", I will have "le niveau sup"
if I send the string "Quelqu'un m'a appel? ?", I will have "Quelqu "
Is someone knows why I have this problem? I use Ptokax...
i don't have the sligest clue maybe if u post all of the script it will help more.
No the problem lies in here:
function Get2Args(data)
s,e,whoTo,from,cmd,arg,arg2= strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s+([%w%s]+)")
return arg,arg2
end
the sign " ' " isn't included in this: [%w%s]
use this code and it should work:
function Get2Args(data)
s,e,whoTo,from,cmd,arg,arg2= strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s+(.+)")
return arg,arg2
end
and this will also work:_
function Get2Args(data)
s,e,arg,arg2= strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(.+)")
return arg,arg2
end
Try to change you regex to:
s,e,arg,arg2= strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S+%s+(%S+)%s+(.+)")
or
s,e,arg,arg2= strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S+%s+(%S+)%s+(.+)|")
I think that this form was for excluding the "|" at the end.
opium your a bit slow :P
33.6k with dl running :)
But you are too fast :)
s,e,arg,arg2= strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.+)")
There where 3 captures :)
feel sorry for you..
<== has 10bit download bandwith..
Thank you SO MUCH Skrollster!!!!
Your first idea was the good one. It works well.
Thank you too OpiumVolage for your help. I didn't test your solution, but I take note of this eventuality.....
Thousands thx :))
DOn't feel sory, this mean i'm at home, ... and in vacations.
Opium: Ok, good for you :P
xjr13sp: if you just are looking for the arguments then the second post should work just as well but will use less resorces..