Jump to content

lihman

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by lihman

  1. I need to scan a page for certain words. If the page has those words, then i want to perform a certain action and if not, then a different action. However, I don't need all of the words to be present on the page, just one of them. How would I do that? For example, if the words that I wanted to look for are: Green Blue Red and $result contained: The blue cat was big. I want if(preg_match..... to say yes even though red and green weren't present. Would I use preg_match or preg_match_all or something else? I basically need like an 'OR' between the terms I am looking for in $result.
  2. Why don't you try running that through this string and see what happens: Sorry, i didn't see that post. I only looked at what Crayon Violent had written. So I stand corrected. #\[.*?\]# will work Thanks for clearing it up MrAdam
  3. Sorry, if u thought I meant it that way. I meant to say that I have tested my solution and it does work. So it is solved for sure. Many of the solutions above may work, but I have not tested them so i cannot say for sure. Actually, upon testing #\[.*\]# , what Crayon Violent and MrAdam have said, I would say it is not recommended. I say this because it will also remove what comes before the brackets. ex. fri[hello]day will become "day". If that does not affect you, then feel free to use it. Upon using (\\[.*?\\]) , you will get "friday" Just throwing it out there
  4. I believe that the starter isn't interested in this thread anymore. I have tested my code and it works for me. Therefore, I request a mod to place a [solved] in the topic name. Thank you PS: Sorry for double posting. Just bringing it into the views of the mods
  5. $option_title = preg_replace('(\\[.*?\\])', '', $option_title); That should work for you
×
×
  • 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.