Jump to content
Sign in to follow this  
michaelslamet

String question

Recommended Posts

michaelslamet

One of my small script need user input, which is only accept minus sign (with or without), number(s), comma(s) and dot(s).

So if user input:

1-1233455678.12121,1999

or

11233455,678.12121.1999

it will considered as valid

and this is considered as invalid:

1123-345a

because it contain character "a"

Currently I can check if the string is consist of A-Z or a-z by using

StringRegExpReplace($sString, "[A-Z]", "")
If @extended > 0 Then $valid = False
 
StringRegExpReplace($sString, "[a-z]", "")
If @extended > 0 Then $valid = False

Thank you :)

Edited by michaelslamet

Share this post


Link to post
Share on other sites
michaelslamet

So you want something like: "[^-,d.]". There I am matching anything that is NOT - or , or 0-9 or .

 

Haha, yes, Mat. Thank you very much :)

That solve my problem :)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×