Is it implied by default in str.scan? Is it off by default in str[regex] ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, how often the regex is applied depends on the method used, not on the regex’s flags.
scan will return an array containing (or iterate over) all matches of the regex. match and
String#[]will return the first match.=~will return the index of the first match. gsub will replace all occurrences of the regex and sub will replace the first occurence.