---
# System prepended metadata

title: '[ruby][regEx]取出括號內的字串'
tags: [regEx, ruby]

---

# [ruby][regEx]取出括號內的字串

###### tags: `ruby`,`regEx`


```ruby!
txt = %Q("user1"<user1@mail.comm>;"user2"<user2@mail.comm>;"user3"<user3@mail.comm>)

output = txt.split(";").map{|x| x[/(?<=\<).+?(?=\>)/]}

p output #=>["user1@mail.comm", "user2@mail.comm", "user3@mail.comm"]

```
