Changing text based on the final letter of user name using regular expression
问题 I am looking to change the ending of the user name based on the use case (in the language system will operate, names ends depending on how it is used). So need to define all endings of names and define the replacement for them. Was suggested to use .gsub regular expression to search and replace in a string: Changing text based on the final letter of user name "name surname".gsub(/e\b/, 'ai') this will replace e with ai, so "name surname = namai surnamai". How can it be used for more options