Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regex question

Status
Not open for further replies.

richardko

Programmer
Jun 20, 2006
127
US
hi,
how do i match anything in the expression other than "certain words".
Say i have bunch of strings like this:
1234.abc.com,
asd.abc.com,
ees.abc.com,


Now i want to match all the strings that do not have " at the start of the string.
For example in the strings above the ones that would get through are:
1234.abc.com
asd.abc.com
ees.abc.com

the should not match.

I have the regext mostly figured out except it matches " also.

Code:
$test = "[URL unfurl="true"]www.abc.com";[/URL]	
	$str2 = "/^[^www]\.?([^\.]+)\.abc\.com/";	
	if( preg_match($str2,$test,$match2) )
	{		
		print_r($match2);
	}
 
richardko,

Why aren't u using the "addslashes" function?

Exp:[/b}
Code:
$test = addslashes("www.abc.com");

Seems most ur problem is there!

YMR
 
thanks for your help but i figured it out...i was testing a mod_rewrite for apache in php and i figured if i could figure this out in php then it would work in mod_rewrite.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top