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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -