combining dynamic text with regular expressions in php
Posted
by pfunc
on Stack Overflow
See other posts from Stack Overflow
or by pfunc
Published on 2010-05-04T14:21:33Z
Indexed on
2010/05/04
14:38 UTC
Read the original article
Hit count: 273
I am experimenting with finding popular keywords using curl, php and regular expressions. I have an array of non-specific nouns that I am matching my keyword search up. So I am looking for words like "the", "and", "that" etc. and taking them out of the keyword search.
so I have an array of words like so:
$wordArr = [the, and, at,....];
and then running something like:
&& preg_match('(\bmyword\w*\b)', $key) == false
how do I combine these two so it loops through the array finding out if any of the words in the array match the regular expression?
I guess I could just do a for loop, but though maybe I could use in_array($wordArr, $key)
.. or something like that.
© Stack Overflow or respective owner