Click here to Skip to main content
15,905,914 members
Home / Discussions / C#
   

C#

 
GeneralRe: New to C# Question Pin
Heath Stewart9-Dec-03 11:33
protectorHeath Stewart9-Dec-03 11:33 
GeneralRe: New to C# Question Pin
Huseyin Altindag9-Dec-03 10:57
Huseyin Altindag9-Dec-03 10:57 
GeneralFirst Call to Function does nothing: c# Pin
Goodspeed20029-Dec-03 3:50
Goodspeed20029-Dec-03 3:50 
GeneralRe: First Call to Function does nothing: c# Pin
Heath Stewart9-Dec-03 6:08
protectorHeath Stewart9-Dec-03 6:08 
GeneralRe: First Call to Function does nothing: c# Pin
Goodspeed20029-Dec-03 12:43
Goodspeed20029-Dec-03 12:43 
GeneralRe: First Call to Function does nothing: c# Pin
Heath Stewart9-Dec-03 14:13
protectorHeath Stewart9-Dec-03 14:13 
QuestionHow to validate regular expression pattern? Pin
gokselm9-Dec-03 3:30
gokselm9-Dec-03 3:30 
AnswerRe: How to validate regular expression pattern? Pin
Heath Stewart9-Dec-03 5:53
protectorHeath Stewart9-Dec-03 5:53 
Just create a new instance of the RegEx. If the regex is invalid, an exception is thrown (this is documented in the class constructor information):
try
{
  Regex re = new Regex("/mypattern/");
  Console.WriteLine("The regular expression is valid.");
}
catch
{
  Console.WriteLine("The regular expression is invalid!");
}
If you move the re declaration outside, you can use it if it's valid after the catch (but then the catch should return or something to keep from trying to use the invalid Regex object).

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: How to validate regular expression pattern? Pin
gokselm10-Dec-03 11:35
gokselm10-Dec-03 11:35 
GeneralChange Notification Pin
mkomasi9-Dec-03 2:50
mkomasi9-Dec-03 2:50 
GeneralRe: Change Notification Pin
Heath Stewart9-Dec-03 3:02
protectorHeath Stewart9-Dec-03 3:02 
GeneralFolder Permissions Pin
Mauricio Ritter9-Dec-03 2:50
Mauricio Ritter9-Dec-03 2:50 
GeneralRe: Folder Permissions Pin
Heath Stewart9-Dec-03 2:56
protectorHeath Stewart9-Dec-03 2:56 
GeneralDesign Technique Pin
Ken Galer9-Dec-03 2:36
Ken Galer9-Dec-03 2:36 
GeneralRe: Design Technique Pin
Heath Stewart9-Dec-03 2:54
protectorHeath Stewart9-Dec-03 2:54 
GeneralRe: Design Technique Pin
hazzem elrefai9-Dec-03 22:47
hazzem elrefai9-Dec-03 22:47 
GeneralRe: Design Technique Pin
Ken Galer10-Dec-03 2:33
Ken Galer10-Dec-03 2:33 
GeneralWord object Pin
hazzem elrefai8-Dec-03 23:57
hazzem elrefai8-Dec-03 23:57 
GeneralRe: Word object Pin
Colin Angus Mackay9-Dec-03 0:19
Colin Angus Mackay9-Dec-03 0:19 
GeneralRe: Word object Pin
hazzem elrefai9-Dec-03 0:35
hazzem elrefai9-Dec-03 0:35 
GeneralRe: Word object Pin
Colin Angus Mackay9-Dec-03 0:56
Colin Angus Mackay9-Dec-03 0:56 
GeneralRe: Word object Pin
hazzem elrefai9-Dec-03 1:17
hazzem elrefai9-Dec-03 1:17 
GeneralRe: Word object Pin
Colin Angus Mackay9-Dec-03 2:15
Colin Angus Mackay9-Dec-03 2:15 
GeneralRe: Word object Pin
hazzem elrefai9-Dec-03 2:35
hazzem elrefai9-Dec-03 2:35 
GeneralRe: Word object Pin
Heath Stewart9-Dec-03 2:51
protectorHeath Stewart9-Dec-03 2:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.