regex - How do you tell Ruby to stop scan after the 1st match of regular expression -
i have tried different examples provided still couldn't solve issue. here's example:
i wan ruby scan text , stop @ 1st occurrence of word happy
bigtext = "i happy. happy. happy too."
i use "?" ruby stop continues scan , return 3 occurrences of "happy"
bigtext.scan(/happy?/)
my version of ruby 2.0.0
Comments
Post a Comment