Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
var searchIn = "The quick brown fox jump over the 3 lazy dogs";
我想从这个字符串中得到 3 只有当它们后面跟着“lazy dogs”时,如果数字是 13,我想得到 13
我发现的唯一方法就是这样做......
var x = Regex.Match(Regex.Match(searchIn, @"\d{1,2} lazy dogs").Value, @"\d{1,2}");
有没有更好的办法?