RegEx

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'd like to create a regular expression pattern that search for alpha
numeric characters as well as . (dot), - (hyphen), _ (underscore), and %
(percent). "\W" matches any non-word character, but how do I filter that I
only want to accept ., -, _, and % in "\W"?

Please advice, thanks!
-P
 
Paul said:
Hi,

I'd like to create a regular expression pattern that search for alpha
numeric characters as well as . (dot), - (hyphen), _ (underscore), and %
(percent). "\W" matches any non-word character, but how do I filter that
I
only want to accept ., -, _, and % in "\W"?

Why don't you use "\w|[.-_%]"?

Niki
 
Cool, thanks!

Niki Estner said:
Paul said:
Hi,

I'd like to create a regular expression pattern that search for alpha
numeric characters as well as . (dot), - (hyphen), _ (underscore), and %
(percent). "\W" matches any non-word character, but how do I filter that
I
only want to accept ., -, _, and % in "\W"?

Why don't you use "\w|[.-_%]"?

Niki
 
Back
Top