473,385 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Regex. Reject space

Hello,

I have the following:
^([a-zA-Z0-9]{8,24})$

It accepts only letters and numbers as expected. But it also accepts
spaces. I don't want that.

What am I doing wrong?

Thanks,
Miguel
Oct 24 '08 #1
3 2065
"shapper" <md*****@gmail.comwrote in message
news:83**********************************@l42g2000 hsc.googlegroups.com...
I have the following:
^([a-zA-Z0-9]{8,24})$

It accepts only letters and numbers as expected. But it also accepts
spaces. I don't want that.

What am I doing wrong?
That pattern looks fine. Post a working snippet of code that demonstrates
the problem. (Something we could paste into a console application and run to
test ourselves.)
Oct 24 '08 #2
"shapper" <md*****@gmail.comwrote in message
news:83**********************************@l42g2000 hsc.googlegroups.com...
Hello,

I have the following:
^([a-zA-Z0-9]{8,24})$

It accepts only letters and numbers as expected. But it also accepts
spaces. I don't want that.

What am I doing wrong?

Thanks,
Miguel
There is a free tool: http://www.radsoftware.com.au/regexdesigner/ that I
use for sorting out regular expressions.

I hope this helps,
Steve


Oct 26 '08 #3
shapper submitted this idea :
Hello,

I have the following:
^([a-zA-Z0-9]{8,24})$

It accepts only letters and numbers as expected. But it also accepts
spaces. I don't want that.

What am I doing wrong?

Thanks,
Miguel
Are you using this in an asp.net regexvalidator? That validator ignores
empty fields! If you don't want to allow an empty field, add a
RequiredFieldValidator.

Hans Kesting
Oct 28 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: hellostephen | last post by:
Hi. I'm looking for a way reject an xml document with an attribute that has whitespace only. This is not so hard when the attribute is an empty string but the whitespaces has me stumped. BTW...
4
by: engwar1 | last post by:
Not sure where to ask this. Please suggest another newsgroup if this isn't the best place for this question. I'm new to both vb.net and regex. I need a regular expression that will validate what...
6
by: Vishant | last post by:
Hi, I'm new to javascript and regEx and trying to solve the following problem. I have a function which validates the password if there is a number:...
4
by: Demetri | last post by:
Lets pretend you have a string array and each element is a sentence. Two of those elements read as follows: 1. The fox escaped from the hound. 2. The fox almost escaped. Now lets say you loop...
2
by: Tim Conner | last post by:
Hi, Thanks to Peter, Chris and Steven who answered my previous answer about regex to split a string. Actually, it was as easy as create a regex with the pattern "/*-+()," and most of my string...
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
3
by: Pascal | last post by:
bonjour hello I would like to trim a string of all its white spaces so i used myString.trim() but it doesn't work as supposed : unsecable space are remaining in the middle of my string... i...
3
by: shofu_au | last post by:
HI Group, I am trying to use the powerfull regex to split an input string. Todate I have been able to split simple strings that have ethier space or comma seperators. I have now come across...
7
by: Nightcrawler | last post by:
Hi all, I am trying to use regular expressions to parse out mp3 titles into three different groups (artist, title and remix). I currently have three ways to name a mp3 file: Artist - Title ...
3
by: =?Utf-8?B?TmF2ZWVu?= | last post by:
Not sure if this is the right forum for this question but couldn'd find another newsgroup. I am new to Regular expressions and would like help in deciding which pattern allows me to split a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.