[SOLVED] Regex builder bug

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

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 922
Реакции
1 206
Баллы
113
Code:
HTML:
Развернуть Свернуть Копировать
http://thorspor20.blogbaker.com/admin/?p=posts.edit&amp;postID=1494589">durklis2 un nekas cits</a></div><div class="actions">[ <a href="http://thorspor20.blogbaker.com/admin/?p=posts.edit&amp;postID=1494589">Edit</a> | <a href="http://thorspor20.blogbaker.com/admin/?p=posts.list&amp;a=posts.statuschange&amp;postID=1494589&amp;sub_a=trash" class="bad">Trash</a> | <a target="_blank" href="http://thorspor20.blogbaker.com/2012/12/05/durklis2-un-nekas-cits">View</a>

Need:
Код:
Развернуть Свернуть Копировать
http://thorspor20.blogbaker.com/2012/12/05/durklis2-un-nekas-cits

Regex:
Код:
Развернуть Свернуть Копировать
http://.*(?=">View)

Not Working....


Please do not post another working regex, but resolve this regex builder bug...

Thanks
 
I have no see bug here, because you have HTML code in single string. So parsed trash. I recomend you use parsing via PBC by flag (tag a, with innertext "View"). Also you can solve your trouble via regexp, in this case it will looks like this:
Код:
Развернуть Свернуть Копировать
http:\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])(?=">View)
Result:
Код:
Развернуть Свернуть Копировать
http://thorspor20.blogbaker.com/2012/12/05/durklis2-un-nekas-cits
 
Hell yeah i posted this part of code in notepad and understood where is problem :)

But anyway your given regex is too long. i'm used:

HTML:
Развернуть Свернуть Копировать
(?<=blank"\ href=").*(?=">View</a>)

I'm using regex builder for most of my stuff as i'm not regex expert. As i see you wrote your regex manually :)

Thanks
 
So is this [SOLVED] then, or not?
 

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