V
VAADADMIN
Looking for a little help. I cannot quite seem to get it right.
Here is the string:
addgroup ASOGRP supgroup(DUMMY0) owner(DUMMY0) data('AUTO SYSTEMS')
Result:
I want to pull out the string owner(DUMMY0) by itself. As my code is
written below, I get the remainder of the string as well. I guess I
need to get the substring of the string.
In the substring owner(DUMMY0), owner will always be there, but the
value in the () will be different. I want to pull the whole string
then I will pull out the value of owner.
I would appreciate any help you could give.
Code:
StreamReader sr1 = new StreamReader(args1);
int FindOccurrence = 1;
while ((sLine1 = sr1.ReadLine()) != null)
{
//string owner = @"(.\b(owner)\b.*)";
string owner = @"owner(\W.*\W)";
MatchCollection Listmatched = Regex.Matches(sLine1,
owner);
string owner1 =
Listmatched[FindOccurrence-1].Value.ToString();
Console.WriteLine(owner1);
}
Thanks
Here is the string:
addgroup ASOGRP supgroup(DUMMY0) owner(DUMMY0) data('AUTO SYSTEMS')
Result:
I want to pull out the string owner(DUMMY0) by itself. As my code is
written below, I get the remainder of the string as well. I guess I
need to get the substring of the string.
In the substring owner(DUMMY0), owner will always be there, but the
value in the () will be different. I want to pull the whole string
then I will pull out the value of owner.
I would appreciate any help you could give.
Code:
StreamReader sr1 = new StreamReader(args1);
int FindOccurrence = 1;
while ((sLine1 = sr1.ReadLine()) != null)
{
//string owner = @"(.\b(owner)\b.*)";
string owner = @"owner(\W.*\W)";
MatchCollection Listmatched = Regex.Matches(sLine1,
owner);
string owner1 =
Listmatched[FindOccurrence-1].Value.ToString();
Console.WriteLine(owner1);
}
Thanks