Actually, my purpose is to validate file name with allowing only English(a-Z), underscore “_”, dot “.” , French chars(a-Z, is it?) and numeric char(0-9).
I see, so you know the list of characters you want to accept. In that case a simple regex which only accepts those characters might be the best way to do this.
(I don't know why you would want to apply such a limitation to the file name, but that's a separate question.)
Yaoyuan Fan
Greenhorn
Joined: Jun 02, 2009
Posts: 10
posted
0
Paul Clapham wrote:I see, so you know the list of characters you want to accept. In that case a simple regex which only accepts those characters might be the best way to do this.
(I don't know why you would want to apply such a limitation to the file name, but that's a separate question.)
What exactly do I need to do?
Do I need to collect all valid chars then check if every input match one in collection?
I don't understand the question. Are you saying that you don't know how to use a regex, or that you don't know how to write a regex for this particular problem, or that you want to use something else instead, or what?
Yaoyuan Fan
Greenhorn
Joined: Jun 02, 2009
Posts: 10
posted
0
Paul Clapham wrote:I don't understand the question. Are you saying that you don't know how to use a regex, or that you don't know how to write a regex for this particular problem, or that you want to use something else instead, or what?
I know how to deal with numeric and English chars in Regex(just input A-Z, 0-9, into my expression pattern), how about those french characters?