Regular expression i htaccess regex, PCRE, POSIX, upotreba Apache .htaccess , mod_rewrite |
|
Alati teme | Način prikaza |
|
23. 07. 2012. | #1 |
član
Certified
Datum učlanjenja: 24.01.2007
Poruke: 92
Hvala: 1
802 "Hvala" u 15 poruka
|
PHP: Url unutar stringa
Pozdrav,
Pokusavam po webu da nadjem neki reg-ex za PHP koji vraca true ukoliko string sadrzi bilo kakav url (sa http i bez, mozda i neki egzoticniji url) osim ako taj url nije unutar URL taga (koji isto radi kao ovaj na forumu). Jedini problem koji imam sa spamerima je taj gde postuju one dugacke tekstove sa gomilom url-ova. Jako retko se javi neki spamer sa url-om izmedju ta 2 BB URL taga. Hvala puno. |
23. 07. 2012. | #2 |
Ivan Dilber
Sir Write-a-Lot
|
Tesko ces to izvesti jednim regExpom jer negative look-behind zahteva fixnu sirinu, a [URL ...] tag moze da sadrzi url koji je proizvoljne duzine... a bez look-behind ne mozes da proveris da li je vec u URL-u
Ja bih to radio mnogo jednostavnije u 2 koraka: kopirao text i uradio preg_replace da pocistim sve [URL...]...[/url] blokove iz njega, pa onda jednostavno proverio da li je posle toga ostao jos neki url u textu.
__________________
Leadership is the art of getting people to want to do what you know must be done. |
23. 07. 2012. | #3 |
expert
Grand Master
Datum učlanjenja: 11.04.2010
Poruke: 998
Hvala: 141
959 "Hvala" u 153 poruka
|
'ajde ti postavi jedan primjer... možda postoji silver bullet, ali što je gluplji regex, to je brži...
|
23. 07. 2012. | #4 |
Ivan Dilber
Sir Write-a-Lot
|
@webarto: ne znam kome je bilo upuceno, ali evo primer za ovo sto ja pricam:
PHP kôd:
__________________
Leadership is the art of getting people to want to do what you know must be done. |
23. 07. 2012. | #5 |
expert
Grand Master
Datum učlanjenja: 11.04.2010
Poruke: 998
Hvala: 141
959 "Hvala" u 153 poruka
|
@ivanhoe, mislio sam da postavi taj jedan spam post, da ne ubadamo...
http://ideone.com/aPqux PHP kôd:
|
23. 07. 2012. | #6 |
član
Certified
Datum učlanjenja: 24.01.2007
Poruke: 92
Hvala: 1
802 "Hvala" u 15 poruka
|
Hvala, sad cu da isprobam.
Spam je sasvim obican. Gomila teksta (bez html tagova) i ponegde url. Evo jednog: Kôd:
http://www.megacenter.dk/phpBB3/viewtopic.php?f=19&t=179269&p=206614#p206614 http://www.giagz.com/post/viewtopic.php?f=7&t=498104&p=651775#p651775 http://forum.cliptricks.com/viewtopic.php?f=11&t=643309&p=919764#p919764 You will never know how it feels until you truly own a pair of Christian Louboutin.. For the past 15 years, Robbins has been doing exactly that. After being on the pill for more than 10 years, my period was really short, brown, and low flow with spotting for several days before actually starting. Initially, I would welcome feedback on what I presented as the preliminary steps. Born shoes are constructed from a perfect leading material. You might not be able to get hold of the right provider with the best possible deal in the very first search without any issues. |
23. 07. 2012. | #7 |
expert
Grand Master
Datum učlanjenja: 11.04.2010
Poruke: 998
Hvala: 141
959 "Hvala" u 153 poruka
|
Trebalo bi da radi: http://rubular.com/r/PSQoFEJi8v
|
24. 07. 2012. | #8 |
banned
Professional
Datum učlanjenja: 04.06.2005
Poruke: 371
Hvala: 0
738 "Hvala" u 83 poruka
|
Možda:
PHP kôd:
__________________
Don't look at me; I'm lost too. “If you can't dazzle them with brilliance, baffle them with bul*s**t.” Poslednja izmena od Br@nkoR : 24. 07. 2012. u 11:12. |
25. 07. 2012. | #9 |
član
Certified
Datum učlanjenja: 24.01.2007
Poruke: 92
Hvala: 1
802 "Hvala" u 15 poruka
|
Hvala i tebi. Nisam stigao jos da isprobam, ali siguran sam da ce neki od njih raditi. Zaboravio sam da kazem da ce url biti moguc i unutar IMG taga, ali vidim da ste vodili racuna i o tome
tnx again! |
|
|