[Gambas-user] Problema with stop event on gb.web.gui

Benoît Minisini benoit.minisini at gambas-basic.org
Mon Sep 18 19:40:25 CEST 2023


Le 18/09/2023 à 19:32, Marco Ancillotti a écrit :
> Ok , I solved with someting like:
> 
> Public Sub WebTextBox1_Change()
> Dim sout As String
> Dim i As Integer = 0
> 
> sout = ""
> For i = 0 To (Len(Last.Text) - 1)
>    If Last.Text[i] Match "^[\\/a-zA-Z0-9.-]+$" Then

That's killing a fly with an atomic bomb! :-)

Do that instead, if you want to save CPU:

	If Last.Text[i] Like "[/a-zA-Z0-9.-]" Then

Don't remember that using "Match" implies loading the PCRE component and 
its shared library, compiling a regexp, and executing it.

I don't think it's needed just for checking one ASCII character!

Regards,

-- 
Benoît Minisini.



More information about the User mailing list