Regex gibt nicht alles aus

brabbelj

brabbelj

Doppel-As
Hi,
ich habe einen Regex für rapidshare links geschrieben, allerdings gibt er nicht alle Links aus. Er gibt z.b. nur jeden 2ten aus, oder nur den ersten und letzten nicht. Ich kann keine regelmäßigkeit dadrin erkennen.

PHP:
<?php

$links = $_POST['links'];

preg_match_all("/http:\/\/rapidshare\.com\/files\/[1-9]{6,10}\/(.*?)\.rar/", $links, $match);



foreach($match as $v1){

foreach($v1 as $v2){
if(strstr($v2, "rapidshare.com")){
echo $v2 . "<br>";
}
}
}



?>

Die Links sehen so aus:
Code:
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633023/Datei-xbb.part01.rar" target="_blank">Part 1</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633099/Datei-xbb.part02.rar" target="_blank">Part 2</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633146/Datei-xbb.part03.rar" target="_blank">Part 3</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633224/Datei-xbb.part04.rar" target="_blank">Part 4</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633266/Datei-xbb.part05.rar" target="_blank">Part 5</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633335/Datei-xbb.part06.rar" target="_blank">Part 6</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633379/Datei-xbb.part07.rar" target="_blank">Part 7</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633428/Datei-xbb.part08.rar" target="_blank">Part 8</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633498/Datei-xbb.part09.rar" target="_blank">Part 9</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633543/Datei-xbb.part10.rar" target="_blank">Part 10</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633571/Datei-xbb.part11.rar" target="_blank">Part 11</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633627/Datei-xbb.part12.rar" target="_blank">Part 12</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633686/Datei-xbb.part13.rar" target="_blank">Part 13</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633748/Datei-xbb.part14.rar" target="_blank">Part 14</a> | 
<a href="http://example.com/out.php?link=extern;url=http://rapidshare.com/files/96633760/Datei-xbb.part15.rar" target="_blank">Part 15</a>

Die Ausgabe bei diesem speziellen Beispiel sieht so aus:
Code:
http://rapidshare.com/files/96633146/Datei-xbb.part03.rar
http://rapidshare.com/files/96633224/Datei-xbb.part04.rar
http://rapidshare.com/files/96633266/Datei-xbb.part05.rar
http://rapidshare.com/files/96633335/Datei-xbb.part06.rar
http://rapidshare.com/files/96633379/Datei-xbb.part07.rar
http://rapidshare.com/files/96633428/Datei-xbb.part08.rar
http://rapidshare.com/files/96633498/Datei-xbb.part09.rar
http://rapidshare.com/files/96633543/Datei-xbb.part10.rar
http://rapidshare.com/files/96633571/Datei-xbb.part11.rar
http://rapidshare.com/files/96633627/Datei-xbb.part12.rar
http://rapidshare.com/files/96633686/Datei-xbb.part13.rar
http://rapidshare.com/files/96633748/Datei-xbb.part14.rar

Kann mir jeamnd helfen?

mfg
brabbelj

PS:
print_r von $match gibt das aus:
Code:
Array ( [0] => Array ( [0] => http://rapidshare.com/files/96633146/Datei-xbb.part03.rar [1] => http://rapidshare.com/files/96633224/Datei-xbb.part04.rar [2] => http://rapidshare.com/files/96633266/Datei-xbb.part05.rar [3] => http://rapidshare.com/files/96633335/Datei-xbb.part06.rar [4] => http://rapidshare.com/files/96633379/Datei-xbb.part07.rar [5] => http://rapidshare.com/files/96633428/Datei-xbb.part08.rar [6] => http://rapidshare.com/files/96633498/Datei-xbb.part09.rar [7] => http://rapidshare.com/files/96633543/Datei-xbb.part10.rar [8] => http://rapidshare.com/files/96633571/Datei-xbb.part11.rar [9] => http://rapidshare.com/files/96633627/Datei-xbb.part12.rar [10] => http://rapidshare.com/files/96633686/Datei-xbb.part13.rar [11] => http://rapidshare.com/files/96633748/Datei-xbb.part14.rar ) [1] => Array ( [0] => Datei-xbb.part03 [1] => Datei-xbb.part04 [2] => Datei-xbb.part05 [3] => Datei-xbb.part06 [4] => Datei-xbb.part07 [5] => Datei-xbb.part08 [6] => Datei-xbb.part09 [7] => Datei-xbb.part10 [8] => Datei-xbb.part11 [9] => Datei-xbb.part12 [10] => Datei-xbb.part13 [11] => Datei-xbb.part14 ) )
 
Code:
preg_match_all("/http:\/\/rapidshare\.com\/files\/[1-9]{6,10}\/(.*?)\.rar/", $links, $match);

I. A. sollte das wohl

Code:
 ... [[B][COLOR="Red"]0[/COLOR][/B]-9]{6,10} ...

heissen.

Gruß Aqualung
 
>.<

Danke für deine Hilfe, jetzt geht es ^^

Den Fehler mach ich jetzt bestimmt nicht mehr ^^

DANKE

mfg
brabbelj
 
Statt [0-9] kann man (zumindest in perl..) auch \d (für digit) oder die POSIX-style characterclass [[:digit:]] benutzen, dann sind solche Fehler weitestgehend ausgeschlossen. (Außerdem ist es zum Beispiel bei der POSIX Schreibweise auch noch "human-readable".)
 

Ähnliche Themen

[Gelöst] Suchen und ersetzen mit Hilfe mehrerer Parameter

gedit *.lang Datei mit eigenen Einfärbungen?

Samba 4 Gast Zugang unter Ubuntu funktioniert nicht

Aura for PHP Konfigurationsproblem

Debian Routing Problem

Zurück
Oben