I would like to use Ruby's regular expression to determine that a particular string (for example, vowel [aiueo]) is stored in an array whenever the String string contains a specific string.How should I describe it?
Below is an example of input and output.
"sayounara"
>["sa", "yo", "u", "na", "ra"]
The string contains the scan
method.
result="sayounara".scan/[^aeiou]*[aeiou]/
# =>["sa", "yo", "u", "na", "ra"]
© 2024 OneMinuteCode. All rights reserved.