Re: regular expressions
- From: "Herfried K. Wagner [MVP]" <hirf-spam-me-here@xxxxxx>
- Date: Sat, 6 May 2006 21:34:13 +0200
"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> schrieb:
need to verify a string against reg exp. to allow only characters and apostrophe and hyphen
using :
========
Function RegExpValidate(sInput,sPattern) as boolean
Dim RegexObj as Regex = New Regex("regularexpression")
return Regex.IsMatch(sInput,sPattern)
End Function
calling with:
==============
RegExpValidate(MyString,"[a-zA-Z'-]")
\\\
Dim IsMatch As Boolean = _
Regex.IsMatch(<Input>, "^[a-zA-Z'-]*$")
///
You do not need to instantiate 'Regex' because 'IsMatch' is a shared method of the 'Regex' class.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
.
- Prev by Date: Re: single to string problem
- Next by Date: Re: regular expressions
- Previous by thread: SMTP won't send until thread terminates
- Next by thread: Re: regular expressions
- Index(es):
Relevant Pages
|