473,666 Members | 2,299 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regular expression to check white space

33 New Member
Hi, I use this regular expression to check alphanumeric with('_' and '-')
Expand|Select|Wrap|Line Numbers
  1. var regex_alphanumeric = /^[a-zA-Z0-9\-\_\s]{2,}$/;
  2.  
but It allows white space also.Now I want to check white space also.

Please help me..


Thanks in Advance..
Ruth
Nov 16 '07 #1
2 15032
Dasty
101 Recognized Expert New Member
So do you want or you dont want to check whitespaces?
If you dont, just remove /s from your regular expressions, because /s represents all whitesspaces (space, tab, newline etc...)

Expand|Select|Wrap|Line Numbers
  1. var regex_alphanumeric = /^[a-zA-Z0-9\-\_]{2,}$/;
Or make your request more clear pls.
Nov 16 '07 #2
RuthC
33 New Member
Thanks Dasty,

Actually i don't want white space..
Now its working fine. Thanks for the help.
Nov 16 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
14701
by: lawrence | last post by:
I'm bad at regular expressions. Is this how I would look for any set of characters that go more than 60 characters without a white space? ..{60} Also, does this match a block of PHP in an HTML page:
2
1796
by: Oriana | last post by:
Hi! I'm trying to 'clean up' this source file using regular expressions in Python. My problem is, that when I try to delete extra lines, my code fails. Here's an example.... /** * * Project: MyProject *
4
736
by: James G. Braum | last post by:
Can someone tell me what this regular expression is matching? /\s*(+\*)|(+)|(* )|()\s*/
1
4234
by: | last post by:
Hi, I have a Regular Expression that will match the format a user provides in a textbox. Ex. Brown,Joe in the textbox I would like the expression to have both whitespace and non-whitespace options after the comma.
5
1736
by: John | last post by:
I am new in Regular Expression. Could someone please help me in following expression? 1. the string cannot be empty 2. the string can only contains AlphaNumeric characters. No space or any special characters are allowed 3. space characters at the end of string is ok 4. the string cannot contains only numeric characters, in other word, the string must contains a least one alpha character Thanks for the help
3
3209
by: James D. Marshall | last post by:
The issue at hand, I believe is my comprehension of using regular expression, specially to assist in replacing the expression with other text. using regular expression (\s*) my understanding is that this will one or more occurrences to replace all the white space between with a comma. This search ElseIf InStr(1, indivline, "$") Then insert a replace statement that uses the regular expression to find and replace all the white space...
3
3326
by: LordHog | last post by:
Hello all, I am attempting to create a small scripting application to be used during testing. I extract the commands from the script file I was going to tokenize the each line as one of the requirements is there one command per line. I have always wanted to learn Regular Expressions, so I was hoping I might do this using Regular Expressions. For a fair number of the command will have the syntax like Write( 0x123, 0x12, 25, 100 ) <-...
4
2110
by: mosesdinakaran | last post by:
Can any one explain how the rule is applied for the following Regular expression $Str = 'the red king'; $Pattern = '/((red|white) (king|queen))/'; preg_match($Pattern,$Str,$Val); Result:
1
1585
by: AAaron123 | last post by:
I found this on the Internet and tried a few of them and they worked in VS2008. Actually it was in a different form but I converted to make a smaller file. The data is the same as the original. I'm confused about how regular expressions work in different systems. I suspect that each system may have some things that do not work in other systems. So my question is: Do the things in the table below work on VS2008? And what is Posix and...
0
8356
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,...
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
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...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5663
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();...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
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
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.