c#用Regular Expression查找字符的index

string myText ="33x99 lorem ipsum  004x44";

//the first matched group index
int firstIndex =Regex.Match(myText,"([0-9]+)(x)([0-9]+)").Index;

//first matched "x" (group = 2) index
int firstXIndex =Regex.Match(myText,"([0-9]+)(x)([0-9]+)").Groups[2].Index;

 

 
posted @ 2013-08-24 03:10  日光之下无新事  阅读(140)  评论(0)    收藏  举报