Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 09-14-2013, 04:49 PM   #1
PSD
PornSiteDomains.com
 
PSD's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: US
Posts: 1,265
Regular expression question

Using php I would like to detect something in a string depending on whether the part immediately after the matched part does not contain certain characters. I think I may need to use a lookahead negative assertion as explained here but it is not working as I would expect so not sure. So for example:

Code:
$string = 'test aadfadf random text kalkdfjakdf>apple peach orange';
I want an expression that will detect everything up to the > so long as apple does not immediately follow the >

I tried

Code:
if(preg_match("/test(.*)>(?!apple))/i",$string)){
echo 'true since apple does not follow > in string';
}else{
echo 'false since apple follows > in string';
}
When the string contains apple after the > it returns false as I expect and need but when I change the string to have peach after the > instead of apple it still returns false and I need it to return true. Any ideas?
PSD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-15-2013, 02:10 AM   #2
freecartoonporn
Confirmed User
 
freecartoonporn's Avatar
 
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
try stackoverflow, i do the same and get issues solved within minutes...

first thing make sure you have regex part correct ...
and then the php is the very easy.
freecartoonporn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-15-2013, 02:13 AM   #3
PSD
PornSiteDomains.com
 
PSD's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: US
Posts: 1,265
ha, I did endup there and your right got answer right away, had an extra parenthese at the end. Thanks for the reply.
PSD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-15-2013, 07:15 AM   #4
freecartoonporn
Confirmed User
 
freecartoonporn's Avatar
 
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
Quote:
Originally Posted by JCK View Post
ha, I did endup there and your right got answer right away, had an extra parenthese at the end. Thanks for the reply.
np, just hit the thanks button.
freecartoonporn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.