Damn Regex,

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

Guest

Hi Folks,

I am having some trouble with a search control I have written, basically I
want the user only to input the characters a-z, 0-9, ?, -(hyphen),
'(apostrophe) with a maximum of 50 characters. This is what I am currently
using:
[\d_a-zA-Z0-9?-]{1,50}

However I cannot seem to get the apostrophe to work correctly. Can anybody
help at all please.
 
Hello,

Are you doing any javascript validation?
If so, You might want to use escape characters for '.
Otherwise an expression like [a-zA-Z0-9-?']{1,50} should work.

--------------------
Thread-Topic: Damn Regex,
thread-index: AcYndVVYYd4N8w/cQ5mGiOko/Id8hQ==
X-WBNR-Posting-Host: 62.253.240.193
From: "=?Utf-8?B?U2hlbQ==?=" <[email protected]>
Subject: Damn Regex,
Date: Wed, 1 Feb 2006 13:20:32 -0800
Lines: 10
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.general
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.general:187783
X-Tomcat-NG: microsoft.public.dotnet.general

Hi Folks,

I am having some trouble with a search control I have written, basically I
want the user only to input the characters a-z, 0-9, ?, -(hyphen),
'(apostrophe) with a maximum of 50 characters. This is what I am currently
using:
[\d_a-zA-Z0-9?-]{1,50}

However I cannot seem to get the apostrophe to work correctly. Can anybody
help at all please.

--

Thank You,
Nanda Lella,

This Posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top