Swapping Letters Using Regular Expression
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Stephen23
2019-7-12
编辑:Stephen23
2019-7-12
"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...
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!