Новые сообщения [новые:0]
Дайджест
Горячие темы
Избранное [новые:0]
Форумы
Пользователи
Статистика
Статистика нагрузки
Мод. лог
Поиск
|
03.06.2013, 22:29
|
|||
---|---|---|---|
|
|||
вопрос по 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:34
|
|||
---|---|---|---|
вопрос по Regax |
|||
#18+
Жуткий паттерн. Так более читаемо: \d.\d{2}.\d{5}-\d.\d{2}.\d{5} ... |
|||
:
Нравится:
Не нравится:
|
|||
|
03.06.2013, 22:35
|
|||
---|---|---|---|
|
|||
вопрос по Regax |
|||
#18+
Antonariy, спасибо, учту! А как быть с последним значением? ... |
|||
:
Нравится:
Не нравится:
|
|||
|
|
start [/forum/topic.php?fid=20&mobile=1&tid=1404574]: |
0ms |
get settings: |
8ms |
get forum list: |
16ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
171ms |
get topic data: |
12ms |
get forum data: |
3ms |
get page messages: |
52ms |
get tp. blocked users: |
2ms |
others: | 12ms |
total: | 284ms |
0 / 0 |