php - Preg matching Arabic? -


i'm attempting preg match link of half in english, half in arabic.

the link example looks like:

"/<arabic>/123/<arabic>-<english>.html"  

the basic preg_match('@<a href="/(.*?).html" >); returns arabic within url means no longer identifiable page, returning "دانلود-رایÚ" example.

i've attempted things i've seen such \p{arabic} returns nothing. there way able capture these links?

it's i'm pretty stumped , can't figure out way around issue.

edit add preg match & i'm attempting match.

preg_match_all('@<a href="/\p{arabic}/(.*?)/\p{arabic}-(.*?)" >@iu',$page,$link); 

example text -

"a href="/دانلود-رایگان-کتاب/کتاب-های-خارجی/مطلب/2120-the-essential-financial.html" 

think twice before using regex parse html.

$doc = new domdocument(); $doc->loadhtml($yourhtml);  $links = $doc->getelementsbytagname('a');  foreach($links $link){   echo $link->getattribute('href'); } 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -