Swapping Letters Using Regular Expression
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Michael Cappello
le 12 Juil 2019
Commenté : Michael Cappello
le 12 Juil 2019
I want to take a character array, find the first vowel and move it to the end. Some examples
- 'Fred' --> 'Frde'
- 'Replace' --> 'Rplacee'
- 'Cannot' --> 'Cnnota'
Is there a regular expression that will accomplish this with a single call to regexp?
Thank you
2 commentaires
Stephen23
le 12 Juil 2019
Modifié(e) : Stephen23
le 12 Juil 2019
"Is there a regular expression that will accomplish this with a single call to regexp?"
There is likely no simple regular expression that will reliably detect the first vowel of every word in the entire English corpus, due to some letters which indicate vowels in some words and consonants in others (particularly w, u, and y).
Like most categorizations, it gets very blurred once you start looking in detail...
What is the first vowel of 'Queen' ?
What about 'Year' ?
Cwm ?
Gym ?
Sydney ?
But not Yesterday...
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!