Anyone have a link to a list of Regex.IsMatch expressions for commonly used
edits, like phone number, date, ssn, etc. An example below was copied from
a book source, but is returning false on "01/01/2005" in strDate. (Just
starting into regular expressions).
Return (Regex.IsMatch( strDate, "^(0[1-9]|1[0-2])[./-]" + _
' "(0[1-9]|1[0-9]|2[0-9]|3[0-1])" + _
' "[./-](\\d{2}|\\d{4}) $"))
TIA
Dean Slindee 3 10243
There are too many slashes in the last part (\\d{2}|\\d{4}) $)
It should be (\d{2}|\d{4})$
"Dean Slindee" <sl*****@charte r.net> wrote in message
news:Xn******** *********@fe05. lga... Anyone have a link to a list of Regex.IsMatch expressions for commonly used edits, like phone number, date, ssn, etc. An example below was copied from a book source, but is returning false on "01/01/2005" in strDate. (Just starting into regular expressions).
Return (Regex.IsMatch( strDate, "^(0[1-9]|1[0-2])[./-]" + _
' "(0[1-9]|1[0-9]|2[0-9]|3[0-1])" + _
' "[./-](\\d{2}|\\d{4}) $")) TIA
Dean Slindee
On 2005-04-20, Dean Slindee <sl*****@charte r.net> wrote: Anyone have a link to a list of Regex.IsMatch expressions for commonly used edits, like phone number, date, ssn, etc. An example below was copied from a book source, but is returning false on "01/01/2005" in strDate. (Just starting into regular expressions).
Return (Regex.IsMatch( strDate, "^(0[1-9]|1[0-2])[./-]" + _
' "(0[1-9]|1[0-9]|2[0-9]|3[0-1])" + _
' "[./-](\\d{2}|\\d{4}) $"))
As Cor mentioned, Expresso ( http://www.ultrapico.com/Expresso.htm) is a
good source of regexes as well as a good app to test them in.
On the above examples, though, a common problem in copying from books
into VB.Net is that a lot of languages force one to escape the backslash
character, while VB.Net does not. In languages like C, you'd type "\\"
when you really want "\".
That's the problem above. Replace "\\d" with "\d" and the regex should
work fine. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jon Maz |
last post by:
Hi All,
Am getting frustrated trying to port the following (pretty simple) function
to CSharp. The problem is that I'm lousy at Regular Expressions....
//from http://support.microsoft.com/default.aspx?scid=kb;EN-US;246800
function fxnParseIt()
{
var sInputString = 'asp and database';
|
by: Johnny |
last post by:
I need to determine whether a text box contains a value that does not convert
to a decimal. If the value does not convert to a decimal, I want to throw a
MessageBox to have the user correct the value in the text box. I have the
following code but when the user enters a decimal value the Regex.IsMatch
catches it (ex. 250.50 should be allowed, but 250.50.0 should not). My code
is as follows:
if( ! Regex.IsMatch( tboxQtyCounted.Text,...
|
by: Tim Conner |
last post by:
Is there a way to write a faster function ?
public static bool IsNumber( char Value )
{
if (Regex.IsMatch( Value.ToString(), @"^+$" ))
{
return true;
}
else return false;
}
|
by: Kijak |
last post by:
Hi,
Im just starting working with REGEX and got a few problems. Could you
tell me how to test if two strings can be found in another. ei:
String to test: "This is a great car you got"
Look for: "great" AND "car"
and what about upper case
|
by: Dennis |
last post by:
Should not the following return False if s="255xxxxyyy"? It seems to return
True.
Regex.IsMatch(s, "")
--
Dennis in Houston
| |
by: Peter Proost |
last post by:
Hi group, can the following be done by using a regex, I want a textbox only
to contain numbers or . / + - ^ , but I've never used a regex before so I
don't know how to go about it. Could I for example check if the typed
character is in a given regex. Maybe this is a stupid question, I don't now.
grtz Peter
|
by: vbmark |
last post by:
I'm new to RegEx in vb.net so I'm not sure how to do this.
I want to know if a string contains two minus signs "-". If there are two
then I want it to return TRUE.
I also need to know if the string contains two plus signs "+". Should this
be a seperate RegEx or can one RegEx check for both signs?
Thanks!
|
by: ommail |
last post by:
Hi
I wonder if regular expressions are in general sower than using
classes like String and
Char when used for validating/parsing text data?
I've done some simple test (using IsMatch()) method and the result was
that Regex
is either as fast or two times slower than method which used methods
from classes
|
by: =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?= |
last post by:
Hi,
I need to validate a textbox to have exactly 4 characters that represent the
number 0001 to 9999 (cannot be 0000).
The regext I came up with rather long:
^(\d){3} | \d{2}\d | \d\d{2} | \d{3}$
and not easilily extendable should the need arise for say 5 or 6 numbered
text.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |