Author Topic: How to take a word from a string?  (Read 93 times)

0 Members and 1 Guest are viewing this topic.

Offline phpSenseiTopic starter

  • Addict
    • View Profile
How to take a word from a string?
« on: July 05, 2009, 04:19:57 AM »
Hello,

wow its been a looooooooooong time since I've been here. Back in the day i use to help out all the noobs lol, but now its time to be helped.

Simple and stupid question

Lets say I have a random sentence everytime a refresh a page, but every sentence will have the word "apple" in there...

ALSO the words apple are in [ b ] bbcodes on purpose.

Code: [Select]
I like eating [b]apples[b] all day long. Because [b]apples[/b] are good.
now i want to know how to delete everything outside the [ b ] [ /b ] tags...

I DONT WANT TO USE EXPLODE! I want to specifically delete everything but preserve any word within the bold tags.
« Last Edit: July 05, 2009, 04:22:55 AM by phpSensei »

Offline thorpe

  • Staff Alumni
  • 'Mind Boggling!'
  • *
    • View Profile
Re: How to take a word from a string?
« Reply #1 on: July 05, 2009, 04:38:25 AM »
You'll want to ask your question in the regex board.
Patience is like bread I say, I ran out of that yesterday.

Debian :: Funtoo :: Hudzilla :: Rute :: How To Ask?

Offline phpSenseiTopic starter

  • Addict
    • View Profile
Re: How to take a word from a string?
« Reply #2 on: July 05, 2009, 04:43:28 AM »
You'll want to ask your question in the regex board.


Im so stupid, i forgot about the 4th parameter of the preg_match...

little rusty.

thanks tho. I wont forget to put it there next time;

PHP Freaks Forums

« on: »

Tired of these ads? Purchase a supporter subscription to get rid of them.