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

How to build this pattern?

A string cannot include any of these symbols: ^ ~ \ & -- % | [ ] : ;
= * ? < #

if (Regex.IsMatch(someString, pattern))
MessageBox.Show("A string cannot include any of these symbols: ^ ~
\ & -- % | [ ] : ; = * ? < #")

How to build this pattern?
Please help!
Thank you.
Sep 10 '08 #1
5 1188
slishnevsky <sl*********@gmail.comwrote:
A string cannot include any of these symbols: ^ ~ \ & -- % | =3F [ ] : ;
= * ? < #

if (Regex.IsMatch(someString, pattern))
MessageBox.Show("A string cannot include any of these symbols: ^ ~
\ & -- % | =3F [ ] : ; = * ? < #")

How to build this pattern?
Do you have to do it with regular expressions? I mean, it's feasibly -
but using string.IndexOfAny is simpler.

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Sep 10 '08 #2
On Sep 10, 5:20*pm, Jon Skeet [C# MVP] <sk...@pobox.comwrote:
slishnevsky <slishnev...@gmail.comwrote:
A string cannot include any of these symbols: ^ ~ \ & -- % | =3F [ ] : ;
= * ? < #
if (Regex.IsMatch(someString, pattern))
* * MessageBox.Show("A string cannot include any of these symbols: ^ ~
\ & -- % | =3F [ ] : ; = * ? < #")
How to build this pattern?

Do you have to do it with regular expressions? I mean, it's feasibly -
but using string.IndexOfAny is simpler.

--
Jon Skeet - <sk...@pobox.com>
Web site:http://www.pobox.com/~skeet*
Blog:http://www.msmvps.com/jon.skeet
C# in Depth:http://csharpindepth.com
Indeed :)

Sep 10 '08 #3
string t = @"^ ~ \ & -- % | [ ] : ;= * ? < #";
Pattern = "^[" + t + "]+?";

Regex.IsMatch(someString, t)
"slishnevsky" <sl*********@gmail.comwrote in message
news:16**********************************@l43g2000 hsh.googlegroups.com...
A string cannot include any of these symbols: ^ ~ \ & -- % | [ ] : ;
= * ? < #

if (Regex.IsMatch(someString, pattern))
MessageBox.Show("A string cannot include any of these symbols: ^ ~
\ & -- % | [ ] : ; = * ? < #")

How to build this pattern?
Please help!
Thank you.
Sep 11 '08 #4
A string cannot include any of these symbols: ^ ~ \ & -- % | [ ] : ;
= * ? < #
if (Regex.IsMatch(someString, pattern))
* *MessageBox.Show("A string cannot include any of these symbols: ^~
\ & -- % | [ ] : ; = * ? < #")
try pattern "\\^|~|\\|&|--|%|\\||\"|\\[|\\]|:|;|=|>|<|#"

then
if (! Regex.IsMatch(someString, pattern))
MessageBox.Show("A string cannot include any of these
symbols: ^ ~ \ & -- % | [ ] : ; = * ? < #")

Regards,
-Ratnesh
S7 Software
Sep 11 '08 #5
On Sep 11, 5:13*pm, Ratnesh Maurya <ratneshmau...@gmail.comwrote:
A string cannot include any of these symbols: ^ ~ \ & -- % | [ ] : ;
= * ? < #
if (Regex.IsMatch(someString, pattern))
* *MessageBox.Show("A string cannot include any of these symbols:^ ~
\ & -- % | [ ] : ; = * ? < #")

try pattern *"\\^|~|\\\\|&|--|%|\\||\"|\\[|\\]|:|;|=|>|<|#"

then
if (! Regex.IsMatch(someString, pattern))
* * * * * * MessageBox.Show("A string cannot include any of these
symbols: ^ ~ \ & -- % | [ ] : ; = * ? < #")

Regards,
-Ratnesh
S7 Software
small correction
"\\^|~|\\|&|--|%|\\||\"|\\[|\\]|:|;|=|>|<|#"
Sep 11 '08 #6

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

Similar topics

2
by: nfr | last post by:
Default build directories seem to be somewhat different between C# and Visual Basic.NET. Both have "Debug" and "Release" directories under "obj". However, Visual Studio.NET defaults to a single...
5
by: | last post by:
Is it possible to extend this function to dynamically create a combo boxes from the db table....How would do this...I tried passing a 'Select' type to the function but got a blank entry....Any...
4
by: Steven T. Hatton | last post by:
Below is some code I wrote to get a better understanding of the dynamic verses static type resolution. My intention was to see if there was a way to use references for the static access to the...
9
by: Harry | last post by:
Hi there, does anyone know how I can build a regular expression e.g. for the string.search() function on runtime, depending on the content of variables? Should be something like this: var...
2
by: zbig555z | last post by:
Hello: I have written an ASP.net app that pulls settings from a database. Part of the setting definition is a regular expression that I want to use on the client via JavaScript for data...
3
by: clintonG | last post by:
Please provide your article reference(s) that document how to use DNF 1.1 panel controls to build a Wizard. I've seen and tried out the DNF 2.0 Wizard Control, I don't like the current...
2
by: Rudy Ray Moore | last post by:
How can I modify the project build order of a multi-project workspace under "Visual Studio .net 2003 7.1 c++"? I tried to modify the .sln by hand to influence the build order, but it didn't seem...
3
by: Julian | last post by:
Build.Net is a build tool that parses and builds VS.NET project files. Build.Net is run from the command line. It recursively searches a directory for VS.NET project files to build. This...
6
by: John Gabriel | last post by:
I have been obtaining the following error in the output window of the IDE: 1>mt.exe:general error c101008d:Failed to write the updated manifest to the resource of file "..\debug\test.exe". The...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
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: 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.