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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -