find in php array words with tribe repeating characters?
Posted on 2014-03-14
I have a problem where I not even know how to start. I guess some regex can solve this but I am out of my knowledge in this case.
I want to clean up a search database table. My system captured lots of words which users typed which dont make sense and I want to delete them.
I read the db table into an php array and now I would like to simple check the words if there are any characters which repeat more than twice behind each other. And if this is the case delete the word.
would pass the test.... but
would be cut...
Important is for me any variable with 3 direct repeating characters only. for example "hihihihi" would not be a problem but "hhhhhiiiiii" would be.
I would be happy if somebody has some short php code for me to filter these words.
Thanks in advance,