Output:
['Fr41m']
Output:
['Fr41m']
Wats the problem with this? I guess its not that accurate to detect spaces ...
More information will be helpful.
Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
{ MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }
When posting a bug, please post debug! Help us, help you!
I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.
SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.
^^ 32.bmp does not fit inbetween
This isn't that big a bug and it's easily solved. The bitmap for space doesn't fit there. So how to solve it?
Simba Code:{$I SRL/SRL.Simba}
Function IsChatBoxTextEx(RegExpr: String; Colour: Integer): Boolean;
var
I, L: Integer;
TSA: TStringArray;
begin
TSA:= ChatBoxTextArray(Colour);
L:= High(TSA);
For I:= 0 To L Do
if ExecRegExpr(RegExpr, TSA[I]) then
begin
Result:= True;
break;
end;
end;
begin
//DO NOT put spaces in the regex. Spaces are denoted by "\s" Non-white-space is denoted by "\S"
//Brackets aren't allowed unless escaped by a backslash and finally the * means to repeat the previous expression 0 or more times.
writeln(IsChatBoxTextEx('(Fr4(\s)*1m)', clBlack));
//The above Regex is equivalent to '(Fr4 1m)|(Fr41m)|(Fr4 1m)|(Fr4 1m)'... etc.. keeps going for an infinite amount of spaces.
end.
Last edited by Brandon; 05-29-2012 at 06:15 PM.
I am Ggzz..
Hackintosher
A regex is not hardcoding.. The way your going about it is literally hardcoding. The fact that it doesn't find your exact and specific text due to a space in it, is hardcoding.
Regular Expressions are otherwise known as pattern matching. It matches a specified pattern.
For an example of a pattern than matches a TPointArray, see here: http://villavu.com/forum/showpost.ph...10&postcount=3
The function is called STRToTPA. It's not hardcoded because you can enter any TPA and it will work. hardcoding is where the values must be very specific.
What I gave you is the ultimate solution. A Regular Expression to match any pattern you like. Of course you'd write your own expressions.
Some useful ones:
Simba Code:'[A-Za-z0-9_]' // Matches A-z, 0-9 and underscore..
'^[A-Za-z]' // Matches A-z only if at the beginning of a line..
'[0-9]*$' //Matches 0-9 any amount of times AND matches the end of a line aka linefeed.
Those are just some examples. Of course there are as many patterns as the mind can think of.
Perhaps you can describe exactly what you want and I can provide a close if not exact solution..
I am Ggzz..
Hackintosher
No amount of regex manipulation will work because the input text is wrong.
Essentially I have an access list that contain array of RSNs that grant users permissions to change calls for the team and a fair bit of ranks have rather popular names. Discarding spaces in the names can lead to unexpected access given to wrong people
Due to this problem, RSNs get read wrong because of 1px error ;x
e.g.
fr4 1m becomes fr41m
pvm2 j4ck becomes pvm2j4ck
Last edited by slushpuppy; 05-30-2012 at 01:31 PM.
If the issue is the spaces, just TrimSpaces() both on what you're looking for and on what the GetText function returns. Voila.
~RM
There are currently 1 users browsing this thread. (0 members and 1 guests)