Jump to content

Recommended Posts

I'm sorry people... I just can't work this out.

$pattern='~\b'.$word.'\b(?![^<]*?>)~';
$string="websites on the web are cobwebs";
if($r['flagged']=='y'){
	$style='flagged';
	$plus = count(preg_match($pattern, strip_tags($my_page)));
	$_SESSION['flagged']=$_SESSION['flagged']+$plus;
}

 

It's just counting massive numbers...

 

I just want it to count instances of the word "web" but not "websites" or "cobwebs". I know I could use spaces to explode the sting but I have good reason for not doing that.

 

Can anyone help me with this?

Link to comment
https://forums.phpfreaks.com/topic/183569-counting-preg_match/
Share on other sites

Neil, your other threads on this topic provide answers (or the best answer we can give based on your input). Please take the time to go back over them. If you're still stuck, please reply there with specific comments on what is/is not working, rather than create dozens of new threads.

Link to comment
https://forums.phpfreaks.com/topic/183569-counting-preg_match/#findComment-968898
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.