I am having some difficulty in using Regular expression in .NET with
C#.
How do I write a regular expression so that it will match both the
following strings and also get me the relevant named groups ?
1. select xcol, ycol from sampletable where zcol='val'
2. select xcol, ycol from sampletable
If I try the following regular expression
^select (?<SelectClause >.*) from (?<FromClause>. *) (where
(?<WhereClause> .*))*$
and execute it with first string the "WhereClaus e" group is not
matched.
Even worse, the where clause part shows up in the "FromClause " group.
Maybe there is a better way to achieve what I am trying to do ?
Any help is appreciated.
Thanx in advance.
C#.
How do I write a regular expression so that it will match both the
following strings and also get me the relevant named groups ?
1. select xcol, ycol from sampletable where zcol='val'
2. select xcol, ycol from sampletable
If I try the following regular expression
^select (?<SelectClause >.*) from (?<FromClause>. *) (where
(?<WhereClause> .*))*$
and execute it with first string the "WhereClaus e" group is not
matched.
Even worse, the where clause part shows up in the "FromClause " group.
Maybe there is a better way to achieve what I am trying to do ?
Any help is appreciated.
Thanx in advance.
Comment