SRL Archive - SRL Suggestions

IsUpTextRegex


Quickmarch

2010-04-21 14:28:48

Thought it might be cool to incorporate regular expressions into uptext finding as it would possibly make it more accurate. This could also be applied to any function that uses text finding (ChooseOption, etc).


const
Pattern = 'U?se ?B?ank ?B?ooth'; //Probably not the best pattern

function IsUpTextRegex(Exp: String; CaseSensitive: Boolean): Boolean;
{$IFNDEF Simba}
var
uptext: String;

begin
uptext := GetUpText;
if (not (CaseSensitive)) then
begin
Exp := Lowercase(Exp);
uptext := Lowercase(uptext);
end;
Result := RegexPos(uptext, Exp) > 0;
{$ELSE}
begin
WriteLn('Not yet supported in simba.');
{$ENDIF}
end;

Atm, it only works on SCAR as simba does not support regex' yet.

Feedback pl0x. :)

Wizzup?

2010-04-21 14:34:36

Hey… this is a pretty good idea… :D

Nava2

2010-04-21 14:54:23

I like this a lot! :)

mastaraymond

2010-04-21 17:58:38

Added regex to Simba (in dev source).