Currently I am using scan(/(\A\w|(?<=\s)\w)/)
regular expression to get the initials from string word
Example str = "Sonu Singh"
str.scan(/(\A\w|(?<=\s)\w)/).flatten.join # output is "SS"
But this regexp
is not working for other language like Cyrillic character, arabic, chinese, hindi etc. Can anyone help me to make signle regexp
and get desired results.
Thank you so much any help or suggestion in any language.
Aucun commentaire:
Enregistrer un commentaire