For example i have the below paragraph in a MySQL database table field
"The cutting off of the illumination of an astronomical object object, as in an eclipse of the Moon, when the Earth comes between"
Here the word "object" appears twice in a row (next to each other).
I want to check if this case appears in other records in same table. Is there an easy way to do this using PHP and MySQL
In rhetoric, epizeuxis is the repetition of a word or phrase in immediate succession, typically within the same sentence, for vehemence or emphasis.
Simply recast the final phrase (“She gives in every time”) or flip the phrase to the front (“In every case, she gives in”).
Using 'That' Twice in a Row When you're trimming unnecessary uses of “that” from your writing, be sure to pay attention to sentences where it appears multiple times or even twice in a row (“that that”). These sentences can be grammatically correct but stylistically undesirable.
Palilalia (from the Greek πάλιν (pálin) meaning "again" and λαλιά (laliá) meaning "speech" or "to talk"), a complex tic, is a language disorder characterized by the involuntary repetition of syllables, words, or phrases.
if (preg_match('/\\b(\\w+)\\s\\1\\b/', $subject)) {
//has repetition
}
This regex works: (\b\w+\b)(?=\s?\1)
(see example)
To make it work in MySQL, the Word Boundaries (\b
) must be replaced with MySQL equivalent [[:<:]]
and [[:>:]]
, and \w
with [[:alnum:]]
:
SELECT * FROM your_table
WHERE your_field REGEXP '([[:<:]][[:alnum:]]+[[:>:]])(?=\\s?\\1)';
But this query gives an error because, as Matt said, MySQL does not support backreferences. So, it's not possible with the current MySQL REGEXP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With