E
Erik Tamminga
Hi,
From the following string I would like to capture text.
String: This action has been executed via Console
First of all I like to know if this is the text I need: it must contain
"This action has been executed via".
Secondly I would like to know "Console"
How can Regular expressions help me in this. I've tried various things with
the RegEx class but I'm having troubles retrieving "Console". The
match.Captures collection always seems to contain the string searched, not
only the captured part.
RegEx r = RegEx( "This action has been executed", RegExOptions.IgnoreCase)
if (r.Matches( myString).Count > 0)
{
Here matches are found and r.Matches[0].Captures.Count > 0.
Why is ...Captures.Count > 0, I did ask for a capture?
}
RegEx q = RegEx( "(C\w+)", RegExOptions.IgnoreCase)
if (q.Matches( myString).Count > 0)
{
Here matches are found and r.Matches[0].Captures.Count > 0.
This is where I expected the capture!!
}
regards,
Erik
From the following string I would like to capture text.
String: This action has been executed via Console
First of all I like to know if this is the text I need: it must contain
"This action has been executed via".
Secondly I would like to know "Console"
How can Regular expressions help me in this. I've tried various things with
the RegEx class but I'm having troubles retrieving "Console". The
match.Captures collection always seems to contain the string searched, not
only the captured part.
RegEx r = RegEx( "This action has been executed", RegExOptions.IgnoreCase)
if (r.Matches( myString).Count > 0)
{
Here matches are found and r.Matches[0].Captures.Count > 0.
Why is ...Captures.Count > 0, I did ask for a capture?
}
RegEx q = RegEx( "(C\w+)", RegExOptions.IgnoreCase)
if (q.Matches( myString).Count > 0)
{
Here matches are found and r.Matches[0].Captures.Count > 0.
This is where I expected the capture!!
}
regards,
Erik