Jump to content

Exclude some chars from gui-edit


DakiLLa

Recommended Posts

Posted

Hi. I want to prevent users typing in some characters in edit field, such as "[", "]" (square brackets), and "^". How can I do that?

Right now I'm using the next pattern:

string.gsub( someText, '[^A-z, ^0-9]', '' ) 

Thx in advance.

Posted (edited)

I don't need to check wether or not there are special chars in the string. I want to make it fix the string automatically, like 'gsub' does.

Edited by Guest
Posted (edited)
local s = 'Kenix\\1' 
print( s ) -- > Kenix\1 
print( s:gsub( '\\', '' ) ) --> Kenix1 

Well if you have string like this it's unfinished string

print( '\' )

P.S \ is hided in bb code.

So if you want use \ char you need:

print( '\\' ) --> \

Edited by Guest

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...