Click here to Skip to main content
15,867,986 members
Home / Discussions / C#
   

C#

 
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 
I'm a bit new to Regex, and almost got this working, except for a small glitch. I have a string called entityName which looks like "120 PP (V987) XYZ", from which I have to strip out the entity code which in this case is (V987). The entity code is V or C followed by any number of digits, all of which is enclosed in ().

My code looks like this:
string[] entityNameString;
Regex regex = new Regex(@"^(.*)(\([V,C]\d+\))(.*)");
entityNameString = regex.Split(entityName);

Console.WriteLine(entityName);
foreach(string s in entityNameString)
{
    Console.WriteLine("\t" + s + "\t\t" + s.Length);
}

Unfortunately, when I run it, the output produced is
120 PP (C987) ERT
                        0
        120 PP          7
        (C987)          6
         ERT            4
                        0


It produces an extra null string at the beginning and the end.
I'm guessing my Regex pattern is incomplete. How should I correct this?

Thanks in advance. Smile | :)

Cheers,
Vikram.
I don't know and you don't either.
Militant Agnostic

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 
QuestionWriting rtf in word document Pin
_mubashir18-Apr-06 19:51
_mubashir18-Apr-06 19:51 
AnswerRe: Writing rtf in word document Pin
mav.northwind19-Apr-06 2:05
mav.northwind19-Apr-06 2:05 
AnswerRe: Writing rtf in word document Pin
Roy Heil19-Apr-06 7:49
professionalRoy Heil19-Apr-06 7:49 
QuestionIs there any easier way to open Directory for Exploring Pin
emran83418-Apr-06 16:04
emran83418-Apr-06 16:04 
AnswerRe: Is there any easier way to open Directory for Exploring Pin
LongRange.Shooter18-Apr-06 17:48
LongRange.Shooter18-Apr-06 17:48 
GeneralRe: Is there any easier way to open Directory for Exploring Pin
emran83419-Apr-06 13:15
emran83419-Apr-06 13:15 
AnswerRe: Is there any easier way to open Directory for Exploring Pin
alexey N18-Apr-06 22:57
alexey N18-Apr-06 22:57 
GeneralRe: Is there any easier way to open Directory for Exploring Pin
emran83419-Apr-06 13:13
emran83419-Apr-06 13:13 
Questionimage gets distorted after resizing Pin
deepak118-Apr-06 14:34
deepak118-Apr-06 14:34 
AnswerRe: image gets distorted after resizing Pin
Guffa18-Apr-06 21:38
Guffa18-Apr-06 21:38 
QuestionSQL SERVER EXPRESS or Professional Pin
emran83418-Apr-06 14:20
emran83418-Apr-06 14:20 
AnswerRe: SQL SERVER EXPRESS or Professional Pin
Paul Conrad18-Apr-06 17:43
professionalPaul Conrad18-Apr-06 17:43 
AnswerRe: SQL SERVER EXPRESS or Professional Pin
LongRange.Shooter18-Apr-06 17:50
LongRange.Shooter18-Apr-06 17:50 
Questionfraction.... Pin
KORCARI18-Apr-06 13:03
KORCARI18-Apr-06 13:03 

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.