|
-
Oct 5th, 2005, 07:44 AM
#1
[RESOLVED] Regex in Mono
the following regex was posted in the vb.net forum for validading an e-mail address.
VB Code:
Dim regEx As New Regex("^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$", RegexOptions.IgnoreCase)
when compiling with mcs (Mono), i get the following errors:
(i don;t know how to create regex)
./Main.cs(76,27): error CS1009: Unrecognized escape sequence `\w'
./Main.cs(76,27): error CS1009: Unrecognized escape sequence `\.'
anyone know how to fix this, or have a better option?
-
Oct 6th, 2005, 04:08 AM
#2
Re: Regex in Mono
I don't know regular expressions at all, but to include a backslash \ character in a string you need to write it twice \\ as \ is used to denote special characters such as a null char \n.
-
Oct 6th, 2005, 06:53 AM
#3
Re: Regex in Mono
thanks. that seemed to work.
i guess i can also add @ to the front of the string (@"regex")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|