"Shortest Match" in Regex Tester Does Not Return the Shortest Match

  • Автор темы Автор темы Cyrix
  • Дата начала Дата начала

Cyrix

Client
Регистрация
16.12.2011
Сообщения
401
Реакции
12
Баллы
18
"Shortest Match" in Regex Tester Does Not Return the Shortest Match

There are often shorter match within the returned text.
 
For example, for
<span class=""><span class="">ABC USD
I want to find the shortest match between ">" and "USD", the correct match should be ABC , but Regex Tester wrongly generated a Regex which returns
<span class="">ABC


84750
 
Последнее редактирование:
For example, for
<span class=""><span class="">ABC USD
I want to find the shortest match between ">" and "USD", the correct match should be ABC , but Regex Tester wrongly generated a Regex which returns
<span class="">ABC


Посмотреть вложение 84750
Shortest match works from what searched text begin with, not from what goes before searched text
You should specify what searched text begin with
for example - (?<=>)\w.*?(?=USD)
 
The regex formula you provided was not what Regex Tester generated (which produced a wrong result), even when "begin with" was used.

84993
 
Последнее редактирование:

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)