Regex Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreRegex Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 6th, 2009, 01:38 AM
Arty Ziff Arty Ziff is offline
Banned
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Apr 2005
Posts: 4,982 Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level)Arty Ziff User rank is General 49th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 2 Weeks 5 Days 19 h 39 m 29 sec
Reputation Power: 0
Will this work?

Will this => ^[A-Za-z0-9 -]*$ work to match and number and combnation of letters, numbers, spaces, and a dash?

Reply With Quote
  #2  
Old September 6th, 2009, 04:07 AM
DevCoach DevCoach is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,585 DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level)DevCoach User rank is General 6th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 2 h 58 m 23 sec
Reputation Power: 1372
Nearly - you need to put the "-" as the first character in the square brackets, otherwise it will complain that you have an unterminated range starting from space. i.e.
^[-A-Za-z0-9 ]*$

It will also match an empty string, which may or may not be what you want. If you want it to match at least one character then replace the * with +.

Dave

Reply With Quote
  #3  
Old September 6th, 2009, 06:24 AM
prometheuzz prometheuzz is offline
User 165270
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 497 prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 5 Days 10 h 14 m 35 sec
Reputation Power: 936
Quote:
Originally Posted by DevCoach
Nearly - you need to put the "-" as the first character in the square brackets, otherwise it will complain that you have an unterminated range starting from space. ...


No, the hyphen is not "seen" as a range character when placed at the start and end of a character class.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreRegex Programming > Will this work?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap