Regex to for checking if a string only has characters from a specified set of characters -


i have list of characters. '(',')','+','_','-','.', (all numbers)

does know regex find out if "mystring" contains characters specified on list of characters?

examples:

123()912 = true 123abd = false empty_string = false 12345 = true

if characters mystring in specified character list, true, otherwise, false.

thank you.

the regular expression ^[0-9(),+_.\-]*$ should it. matches start of string, 0 or more characters in list given above, end of string.


Comments