ruby - Why does /[<>]/ not return both angle brackets with String#match? -
i expect example match 2 characters <
and >
:
a = "<1acf457f477b41d4a363e89a1d0a6e57@open-xchange>" a.match /[<>]/ # => #<matchdata "<">
it matches first character. why?
#match
returns first match have seen matchdata, #scan
return matches.
>> a="<1acf457f477b41d4a363e89a1d0a6e57@open-xchange>" => "<1acf457f477b41d4a363e89a1d0a6e57@open-xchange>" >> a.scan /[<>]/ => ["<", ">"]
Comments
Post a Comment