Ruby's regular expression, which you want to store in an array every time a specific string is included.

Asked 1 years ago, Updated 1 years ago, 67 views

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"]

ruby regular-expression

2022-09-30 19:51

1 Answers

The string contains the scan method.

result="sayounara".scan/[^aeiou]*[aeiou]/
# =>["sa", "yo", "u", "na", "ra"]


2022-09-30 19:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.