|
вопрос по Regax
|
|||
---|---|---|---|
#18+
Всем привет! Подскажите пожалуйста как можно в Regax отобразить последние совпадение? Вот мой код: StreamReader sr = new StreamReader(dir); string input; string pattern = "[0-9].[0-9][0-9].[0-9][0-9][0-9][0-9][0-9]-[0-9].[0-9][0-9].[0-9][0-9][0-9][0-9][0-9]"; while (sr.Peek() >= 0) { input = sr.ReadLine(); Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase); MatchCollection matches = rgx.Matches(input); if (matches.Count > 0) { Console.WriteLine("{0} ({1} matches):", input, matches.Count); foreach (Match match in matches) Console.WriteLine( matches.Count); } } sr.Close(); Console.ReadLine(); ... |
|||
:
Нравится:
Не нравится:
|
|||
03.06.2013, 22:29 |
|
вопрос по Regax
|
|||
---|---|---|---|
#18+
Жуткий паттерн. Так более читаемо: \d.\d{2}.\d{5}-\d.\d{2}.\d{5} ... |
|||
:
Нравится:
Не нравится:
|
|||
03.06.2013, 22:34 |
|
вопрос по Regax
|
|||
---|---|---|---|
#18+
Antonariy, спасибо, учту! А как быть с последним значением? ... |
|||
:
Нравится:
Не нравится:
|
|||
03.06.2013, 22:35 |
|
|
start [/forum/topic.php?fid=20&msg=38284432&tid=1404574]: |
0ms |
get settings: |
9ms |
get forum list: |
14ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
64ms |
get topic data: |
12ms |
get forum data: |
2ms |
get page messages: |
53ms |
get tp. blocked users: |
1ms |
others: | 15ms |
total: | 178ms |
0 / 0 |