Click here to Skip to main content
15,886,137 members
Home / Discussions / C#
   

C#

 
GeneralXMLA Function Parser Pin
Anonymous7-Oct-02 7:54
Anonymous7-Oct-02 7:54 
GeneralPrint function Pin
D Shen7-Oct-02 7:39
D Shen7-Oct-02 7:39 
GeneralRe: Print function Pin
shmuelt8-Oct-02 0:40
shmuelt8-Oct-02 0:40 
GeneralOverriding base collections and using PropertyGrid Pin
Zombies with Coffee, LLC7-Oct-02 5:51
professionalZombies with Coffee, LLC7-Oct-02 5:51 
GeneralRe: Overriding base collections and using PropertyGrid Pin
leppie7-Oct-02 7:13
leppie7-Oct-02 7:13 
GeneralMatch and Regular Expression Pin
mkomasi7-Oct-02 3:58
mkomasi7-Oct-02 3:58 
GeneralRe: Match and Regular Expression Pin
Paul Riley7-Oct-02 4:59
Paul Riley7-Oct-02 4:59 
GeneralRe: Match and Regular Expression Pin
Richard Deeming7-Oct-02 6:02
mveRichard Deeming7-Oct-02 6:02 
This should work:
using System.Text.RegularExpressions;
...
string expr = "(X, <OS:Size>, Z), (X, <OS:Type>, Y), (X, <OS:DateModified>, W), (X, <PDF:Title>, U)";
 
Regex re = new Regex("(\\([^,]*,\\s*<[^>]*>,[^)]*\\))");
 
MatchCollection matches = re.Matches(expr);
string[] str = new string[matches.Count];
for (int i=0; i < matches.Count; i++)
    str[i] = matches[i].Value;
Explanation of the regular expression:
  • (...) - Capture the result of this expression as a match;
  • \\(...\\) - The expression is contained within regular brackets. NB: The bracket must be escaped, since it has special meaning for regular expressions. Since this is a normal C# string, the escape character must also be escaped;
  • [^,]*,... - Match anything except a comma zero or more times, followed by a comma;
  • ...\\s*... - Match zero or more white-space characters;
  • ...<[^>]*>,... - Match the < charcter, followed by zero or more characters which are not >, followed by >, followed by a comma;
  • ...[^)]* - Match anything except a closing bracket.

To avoid having to escape the escape characters, you could make the regular expression string a verbatim string, by prefixing it with the @ symbol:
Regex re = new Regex(@"(\([^,]*,\s*<[^>]*>,[^)]*\))");

QuestionHow to convert byte[] to int[]? Pin
Konstantin Vasserman7-Oct-02 3:49
Konstantin Vasserman7-Oct-02 3:49 
AnswerRe: How to convert byte[] to int[]? Pin
Paul Riley7-Oct-02 5:17
Paul Riley7-Oct-02 5:17 
GeneralRe: How to convert byte[] to int[]? Pin
Konstantin Vasserman7-Oct-02 5:38
Konstantin Vasserman7-Oct-02 5:38 
GeneralRe: How to convert byte[] to int[]? Pin
Paul Riley7-Oct-02 5:55
Paul Riley7-Oct-02 5:55 
GeneralRe: How to convert byte[] to int[]? Pin
Konstantin Vasserman7-Oct-02 6:07
Konstantin Vasserman7-Oct-02 6:07 
GeneralRe: How to convert byte[] to int[]? Pin
leppie7-Oct-02 7:20
leppie7-Oct-02 7:20 
GeneralRe: How to convert byte[] to int[]? Pin
Konstantin Vasserman7-Oct-02 7:48
Konstantin Vasserman7-Oct-02 7:48 
GeneralRe: How to convert byte[] to int[]? Pin
Richard Deeming7-Oct-02 7:42
mveRichard Deeming7-Oct-02 7:42 
GeneralRe: How to convert byte[] to int[]? Pin
Konstantin Vasserman7-Oct-02 7:55
Konstantin Vasserman7-Oct-02 7:55 
GeneralDataGrid Updates Pin
Dave Moor7-Oct-02 1:25
Dave Moor7-Oct-02 1:25 
QuestionHow to use scripts in my applicaction?!? Pin
EdgarBM6-Oct-02 23:58
EdgarBM6-Oct-02 23:58 
GeneralAspose.Obfuscator 1.0 Released! Pin
Aspose Pty Ltd6-Oct-02 21:31
Aspose Pty Ltd6-Oct-02 21:31 
GeneralRe: Aspose.Obfuscator 1.0 Released! Pin
Stephane Rodriguez.6-Oct-02 22:19
Stephane Rodriguez.6-Oct-02 22:19 
GeneralRe: Aspose.Obfuscator 1.0 Released! Pin
leppie7-Oct-02 8:24
leppie7-Oct-02 8:24 
GeneralRe: Aspose.Obfuscator 1.0 Released! Pin
Patrick Lassalle14-Oct-02 12:01
Patrick Lassalle14-Oct-02 12:01 
Questionsetup wizered? Pin
imran_rafique6-Oct-02 17:45
imran_rafique6-Oct-02 17:45 
GeneralC# Debug problem in VS7 Pin
Elf6-Oct-02 16:45
Elf6-Oct-02 16:45 

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.