- what the right grouping character is
- whether I need to escape it or not
- which Regex class to start with
- what the right terminology is for getting the sub-matches out of the match etc.
Anyway here's a handy reminder to myself:
string strServer = System.Text.RegularExpressions.Regex.Match(strCon,"Data Source=(.+?);").Groups[1].Value;
Note the (.+?);
The trailing ? forces the match not to be greedy and only match up to the first semi colon.
No comments:
Post a Comment
Comments are very welcome but are moderated to prevent spam.