Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-11-2007, 08:59 PM   #1 (permalink)
contiw
Recruit
 
Join Date: Apr 2007
Posts: 2
contiw is on a distinguished road
Help with RegEx validation ...

So far I have this regex code

/[^a-z\-\,\']|(\,.*\,)$/

which should check if a string is:
contains just alpha nocase,
one or more single spaces allowed,
apostrophe and dash allowed,
just one comma allowed

Unfortunately it doesn't work.
Any help cordially appreciated.

contiW
contiw is offline   Reply With Quote
Old 04-12-2007, 07:54 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,446
sde is on a distinguished road
when you put the "^" inside the brackets, that meanse NOT. so your expression would NOT match a-z, -, and '

try this:

/^[a-z\-\,\'](\,.*\,)$/

i'm not 100% on if all those characters need to be escaped, but that should at least get you on the right track.
__________________
Mike
sde is offline   Reply With Quote
Old 04-12-2007, 09:28 AM   #3 (permalink)
contiw
Recruit
 
Join Date: Apr 2007
Posts: 2
contiw is on a distinguished road
Thanks very mucho.
ContiW
contiw is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation krisl100 Standard C, C++ 1 10-18-2006 01:31 PM
need help with a regex sde HTML, XML, Javascript, AJAX 4 01-20-2006 12:22 AM
regex for allowed characters in a form field DogTags PHP 1 03-13-2005 08:42 AM
regex philthee Java 5 11-01-2004 04:34 AM


All times are GMT -8. The time now is 08:41 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting