Hi
I am trying to have backslash(\) in my expression.Its an escape character but for its own use in an expression,I am unable to find a solution.I have tried "\\\\" but it doesnt accepts it.
\\ matches the backslash character, so for example if the expression is entered from a console that would match. However if the pattern is created from a string literal then you would need "\\\\" (double backslashes are required for a backslash in string literals).
Hi
My Requirement is ---Only the following characters are allowed in integer fields:
0 - 9, ( ) + <space> , - / \
and the regex that I have used is "^\\+?[0-9\\(?\\)\\s\\-\\,\\/]*" which works fine but if I add "\\\\" into it for validation of backslash ,invalid character error is thrown.
I'm not sure why that isn't working for you, it looks fine to me although there are a few unnecessary escapes and a rogue "?" in the expression you posted, though for me they dont cause any exception to be thrown.
This is a slightly cleaner version of your expression that works fine for me: "^\\+?[-0-9]()\\s,-/\\\\]*"
If you just use "\\\\" on it's own do you still get the exception? Maybe it's environmental?
On top of spaghetti all covered in cheese, there was this tiny ad:
New web page for Paul's Rocket Mass Heaters movies