What's regex for stop here!!

jp1

Client
Регистрация
23.01.2011
Сообщения
234
Благодарностей
2
Баллы
0
With (?<=\<A href\=\"\/).*(?=\"\>)

I get stuff like:
----------------------------------- match # 19 -----------------------------------
board/bd0000092/threads/
----------------------------------- match # 20 -----------------------------------
board/bd0000127/threads/
----------------------------------- match # 21 -----------------------------------
board/bd0000093/threads/">Film Festivals<BR></A>Discuss film festivals past, current, and future. <BR>If you’re a filmmaker or a film festival or screenplay competition organizer, don’t miss <A href="https://www.withoutabox.com/
----------------------------------- match # 22 -----------------------------------
board/bd0000128/threads/
----------------------------------- match # 23 -----------------------------------
board/bd0000009/threads/
Match 21 behaves differently because it thinks (?=\"\>) refers to the second "> (after withoutabox.com/) and not the first. How to get the first? thanks
 

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
Try using the shortest match. (?<=\<A href\=\"\/.*?(?=\"\>)
 

jp1

Client
Регистрация
23.01.2011
Сообщения
234
Благодарностей
2
Баллы
0

fthomas137

Client
Регистрация
18.06.2011
Сообщения
91
Благодарностей
11
Баллы
0
A more detailed definition is that the '?' operating right after the * is telling regex to NOT BE GREEDY. When it make the 1st match at the end instead of the last match is not being greedy. Make sense :confused:

Drove me to drink until I figured it out, lol.

Frank
 

polas

Новичок
Регистрация
19.03.2012
Сообщения
2
Благодарностей
0
Баллы
0
I make a new topic but i need yuor help for extracting urls and description like this but just as http://www. and description under it the same as in google.

actually link grabber need and with decscription code.

Example

remove this junks like in the and of url tring

<h3 class="r"><a href="/url?q=http://www.anysite.com/&amp;sa=U&amp;ei=rWFnT8y1I4O3hAe574y7Cw&amp;ved=0CDMQFjAF&amp;usg=AFQjCNH_7uTCRf9bjDE7wU7dlK1zL_eGOA">Effective <b>Dog Training</b> Tips and Advice by DogTrainingAtoZ.com</a></h3>

and leave like that only

http://www.anysite.com
and <b>any description under link above</b>

Like this

This is a link

And this is a description

How to do this ?

Thanks.
 

polas

Новичок
Регистрация
19.03.2012
Сообщения
2
Благодарностей
0
Баллы
0
I meanded i can't make any topic for now so that's why i have put it here.
 

shinigami

Client
Регистрация
01.05.2011
Сообщения
164
Благодарностей
91
Баллы
0
(?<=\<h3 class\=\"r\"\>).*?(?=\<\/h3\>) - to get this text with junk
(?<=\<a href\=\"\/url\?q\=).*?(?=&amp;-) - to get url from previous result
(?<=\<b\>).*?(?=\<\/b\>) - to get description
 

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