GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   php question (https://gfy.com/showthread.php?t=173497)

JDog 09-11-2003 11:34 PM

php question
 
i'm a php programmer, just never really messed with regular expressions. now i'm running into a problem :) I'm trying to creat a regular expression that will read a line of text from a file and if it has href=someurl. But nothing is working. here is what I hvae so far.
PHP Code:

preg_match("/href='(.*)'/"$testing$testing2); 

but doesn't seem to work if the $testing variable has:
PHP Code:

$testing "<a href=james.com>" 

Thanks in advance for any help :)

jDoG

com 09-11-2003 11:38 PM

Go to google and lookup the Tao of Regular Expressions, or go buy Mastering Regular Expressions... or steal it.

jwerd 09-11-2003 11:38 PM

Well, I'd do this a little differently:

<?php
//Something.txt will contain something needed in the search//

$fp = @fopen("something.txt", "r");
while($buffer = fread($fp, 1024))
{
if(strstr($buffer, "something"))
{
echo " I found something, $buffer! ";
} else {
die()
}

again, I am kind of tired so I am not sure if this will work because I haven't tested it - have no way of testing it - and again, I am sleepy... but if that is something that will help you, USE IT!

Peace

Jimbo 09-11-2003 11:40 PM

"/href=[\"' ]?([^\"' >]+)[\"' ]?[^>]*>/i"

try this

JDog 09-12-2003 12:09 AM

Quote:

Originally posted by Jimbo
"/href=[\"' ]?([^\"' >]+)[\"' ]?[^>]*>/i"

try this

thanx man!
worked fucking great!

jDoG


All times are GMT -7. The time now is 10:17 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123