Click here to Skip to main content
15,910,787 members
Home / Discussions / C#
   

C#

 
AnswerRe: crystall report viewer Pin
crazymubashir19-Apr-06 20:13
crazymubashir19-Apr-06 20:13 
QuestionPlug-in based development… Pin
anderslundsgard18-Apr-06 21:16
anderslundsgard18-Apr-06 21:16 
AnswerRe: Plug-in based development… Pin
Jon Hulatt19-Apr-06 0:39
Jon Hulatt19-Apr-06 0:39 
GeneralRe: Plug-in based development… Pin
anderslundsgard19-Apr-06 3:21
anderslundsgard19-Apr-06 3:21 
QuestionUse dll file written by C++ MFC in C# Pin
cuongcntt200218-Apr-06 21:08
cuongcntt200218-Apr-06 21:08 
AnswerRe: Use dll file written by C++ MFC in C# Pin
Aaron Dilliard19-Apr-06 4:01
Aaron Dilliard19-Apr-06 4:01 
QuestionException: Array index out of bounds Pin
Kranti125198418-Apr-06 21:03
Kranti125198418-Apr-06 21:03 
AnswerRe: Exception: Array index out of bounds Pin
Tehnoon18-Apr-06 22:09
Tehnoon18-Apr-06 22:09 
GeneralRe: Exception: Array index out of bounds Pin
J4amieC18-Apr-06 22:11
J4amieC18-Apr-06 22:11 
AnswerRe: Exception: Array index out of bounds Pin
Guffa18-Apr-06 22:09
Guffa18-Apr-06 22:09 
GeneralRe: Exception: Array index out of bounds Pin
Kranti125198418-Apr-06 22:18
Kranti125198418-Apr-06 22:18 
GeneralRe: Exception: Array index out of bounds Pin
J4amieC18-Apr-06 23:06
J4amieC18-Apr-06 23:06 
GeneralRe: Exception: Array index out of bounds Pin
Kranti125198418-Apr-06 23:09
Kranti125198418-Apr-06 23:09 
GeneralRe: Exception: Array index out of bounds Pin
J4amieC18-Apr-06 23:48
J4amieC18-Apr-06 23:48 
GeneralRe: Exception: Array index out of bounds Pin
Kranti125198419-Apr-06 0:24
Kranti125198419-Apr-06 0:24 
GeneralRe: Exception: Array index out of bounds Pin
J4amieC19-Apr-06 0:40
J4amieC19-Apr-06 0:40 
Questioncombo boxes and picture uploading in c# Pin
nomsnoms18-Apr-06 21:02
nomsnoms18-Apr-06 21:02 
GeneralRe: combo boxes and picture uploading in c# Pin
Yuvi Panda19-Apr-06 2:46
Yuvi Panda19-Apr-06 2:46 
Questionusage of GE API Pin
naveedqau18-Apr-06 20:18
naveedqau18-Apr-06 20:18 
QuestionHow we transfer a table from dbf to sql server 2000 through programming in c# with table schema Pin
Vinod Soni18-Apr-06 20:17
Vinod Soni18-Apr-06 20:17 
Questionexport the contents of a datagrid to a SQL 2000 Pin
Gavish George18-Apr-06 20:03
Gavish George18-Apr-06 20:03 
QuestionRegex.Split() produces extra null strings Pin
Vikram A Punathambekar18-Apr-06 19:58
Vikram A Punathambekar18-Apr-06 19:58 
AnswerRe: Regex.Split() produces extra null strings Pin
Guffa18-Apr-06 20:48
Guffa18-Apr-06 20:48 
GeneralRe: Regex.Split() produces extra null strings Pin
Vikram A Punathambekar18-Apr-06 21:19
Vikram A Punathambekar18-Apr-06 21:19 
GeneralRe: Regex.Split() produces extra null strings Pin
Jon Hulatt19-Apr-06 0:53
Jon Hulatt19-Apr-06 0:53 
It really doesn't look like you actually want to be splitting the string at all.

if you try this:-

Regex regex = new Regex(@"^(.*)(\([V,C]\d+\))(.*)");
Match m = regex.Match(entityName);
if (m.IsMatch)
  Console.WriteLine( m.Groups[2].Value);


Furthermore, your regular expression could be optimised a little - many of the brackets are unnecessary:-

^.*(\([VC]\d+\)).* should work also. Note the the submatch group number as used in my above code will be 1 for this pattern.

And if you move your submatch brackets a bit, like this,

^.*\(([VC]\d+)\).* then your submatch for the string "120 PP (C987) ERT" will contain "C987". I am of course making a wild assumption here that you don't want the brackets in the output.

Incidentally, I didn't test the above code or patterns, but they're good in substance even if they have minor errors in.

using System.Beer;

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.