August 26th, 2013, 08:01 AM
Delete words according to a list of words
Hi, starting from a string i need to re-elaborate it deleting words that are unnecessary.
The string may have only one or more than one of those words. I want insert those words directly into the RegEx code, but what is right the syntax to use?
For exemple, some of the words that i want to delete are "of", "I", "finding", "want", "one", "two", and all numbers.
So, a string og genere: "I want chocolate", should become "chocolate"
August 26th, 2013, 06:00 PM
Post some example data of what the lines look like before any change and what you want them to look like afterwards.
August 27th, 2013, 05:19 AM
"150 dogs" -> "dogs"
"searching for a woman" -> "woman"
"flames and shadows" -> "flames shadows"
"i like the blu color" -> "blu color"
"i love to surf" -> "surf"
Actually i've created an array with all "blacklisted" words, and with a loop i proceed to delete it from the original string, but i think that for this operation is better to use regex.
So i wanna place all the "blacklisted" words directly in the regex syntax, and delete it when matched (in my case, i will use str_replace of PHP)
August 27th, 2013, 09:41 PM