Düzenli ifade acemi

0 Cevap php

I have been reading about regular expressions for around a couple of hours and I still cannot get my head around this: I am trying to pull the anchor text from a link that is formatted this way:

<h3><b>File</b> : <a href="/en/browse/file/variable_text">i_want_this</a></h3>

"I_want_this:" Ben bağlantı için tek çapa metin istiyorum

Bunu göz ardı etmek gerekir bu yüzden "variable_text" dosya adına göre değişir.

Ben bu regex kullanıyorum:

<a href=\"\/en\/browse\/file\/variable_text\">(.*?)<\/a>

This is matching of course the complete link.
I have not managed to figure out how to only retrieve "i_want_this" and put it in a variable.

Eğer sağlayabilir herhangi bir yardım için teşekkür ederiz!

EDIT: yeterince spesifik olmadığı için üzgünüm. Ben PHP kullanıyorum

0 Cevap