Re: I need validation to fail on an apostrophe entered into a textbox for my regularexpression validator
- From: "hamsterchaos@xxxxxxxxx" <hamsterchaos@xxxxxxxxx>
- Date: Mon, 05 Nov 2007 14:46:27 -0000
On 5 Nov, 13:44, Jesse Houwing <jesse.houw...@xxxxxxxxxxxxxxxx> wrote:
Hello hamsterch...@xxxxxxxxx,
<asp:RegularExpressionValidator id="valRegEx" runat="server"
ControlToValidate="textbox1"
ValidationExpression=" "
ErrorMessage="* Please only enter alphanumeric values and make sure
you are not entering in any apostrophes."
display="dynamic">*
I need
"Chris's mail"
to fail the above validation - which I believe means I need the
regular expression to return a no match on the above line.
Can you help?
The expression must capture what it should be, not what it shouldn't be.
In your case that's quite easy:
^[a-zA-Z0-9 ]+$
any alphanumeric character or space. You can add other allowed characters
in there if needed.
I do wonder why you want to exclude these characters. If it is to prevent
SQL injection or cross site scripting, then adding a regex validator to your
textboxes isn't the best idea to employ.
--
Jesse Houwing
jesse.houwing at sogeti.nl
that is exactly what im trying to do - avoid sql injections - waht
woudl you reccomend fine sir?
BTW thanks for helping
.
- Follow-Ups:
- Re: I need validation to fail on an apostrophe entered into a textbox for my regularexpression validator
- From: hamsterchaos@xxxxxxxxx
- Re: I need validation to fail on an apostrophe entered into a textbox for my regularexpression validator
- References:
- Prev by Date: OnClick - Method With Databind
- Next by Date: Re: I need validation to fail on an apostrophe entered into a textbox for my regularexpression validator
- Previous by thread: Re: I need validation to fail on an apostrophe entered into a textbox for my regularexpression validator
- Next by thread: Re: I need validation to fail on an apostrophe entered into a textbox for my regularexpression validator
- Index(es):
Relevant Pages
|