473,396 Members | 1,771 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,396 software developers and data experts.

Why the code is not able to detect #@<>?

6
Expand|Select|Wrap|Line Numbers
  1. Regex regExp = new Regex("^[a-zA-Z0-9\\/(),_s]+$");
  2. some code in between
  3. if (regExp.IsMatch(status.ToString()))
  4. {
  5. lblStatus.Text = "Comment added successfully.";
  6. lblStatus.ForeColor = System.Drawing.Color.Blue;
  7. }
  8. else
  9. {
  10. lblStatus.Text = "Comment failed to add!!!.";
  11. lblStatus.ForeColor = System.Drawing.Color.Red;
  12. }
I have written the code but somehow when i want to filter out it fall into the true section.(i have to remove the '\' for '\-' and '\s' as it give me an error of unrecognized escape sequence)
i would like to know where did i go wrong?
Dec 9 '12 #1
3 1923
Rabbit
12,516 Expert Mod 8TB
The reason it doesn't match those characters is because they're not in your regex anywhere.
Dec 9 '12 #2
TearX
6
So what do i have to do to make fall into the fail section??
do i need to change my if statemnet?
i am very confude right now
Dec 10 '12 #3
Rabbit
12,516 Expert Mod 8TB
Fail section? You mean you want it to not match those characters? What you have is fine. If they put any of those characters in there, it will go into the fail section.

Your original question sounded like you wanted to match those characters.
Dec 10 '12 #4

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

Similar topics

2
by: Aquarius2431 | last post by:
Hi!, I don't think I have posted to this group before. Have been using PHP on my webserver for a few months now and finding that I like it quite a bit. Here is a question that just occurred...
8
by: R. Rajesh Jeba Anbiah | last post by:
Here is a nice code to detect utf-8 <http://in2.php.net/utf8_encode#39986> But, I couldn't find out the logic behind the script. If anyone knows that please share. Particularly I would like to...
16
by: Dario de Judicibus | last post by:
I'm getting crazy. Look at this code: #include <string.h> #include <stdio.h> #include <iostream.h> using namespace std ; char ini_code = {0xFF, 0xFE} ; char line_sep = {0x20, 0x28} ;
2
by: Keith Wilby | last post by:
The link below: http://support.microsoft.com/default.aspx?scid=kb;en-us;128814 to the Microsoft KB "Detect Idle Time" article shows how to detect "idle" time. However, if a user is active but...
2
by: Christian Blackburn | last post by:
Hi Gang, Can someone show me how to detect the name of the variable received by a procedure? I'd really appreciate it. I would like the following code to detect the name of the strStupid...
1
by: Eric Rupp via .NET 247 | last post by:
I am designing a program that will detect when a computer becomes locked (screen saver comes on/Ctrl+Alt+Del). I am looking to detect that and update a database for a custom Time Tracker program. ...
2
by: Sped | last post by:
Hi, I'm looking for some code to monitor for when an external drive is connected to a computer (USB ThumbDrive, External Hard Drive, etc.) and is assigned a drive letter. I'd want my code to...
0
by: Tim Anderson | last post by:
I've posted some sample code here: http://www.itwriting.com/blog/?p=198
2
by: xoinki | last post by:
Hi all, I have this sample data in a .txt file, -- Ne doit pas faire -- é select PARC.CONTYP , PARC.CONSTA , count(*) from ParcNonCede PARC
4
by: vunet | last post by:
When user enlarges font with Ctrl+ I want to increase the dimensions of my fixed sized div. IE7 uses zoom-in, so it will increase div dimensions automatically. Firefox, however, increases font...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.