Skip to content

Instantly share code, notes, and snippets.

@letusfly85
Created April 30, 2014 16:14
Show Gist options
  • Save letusfly85/f22e96622132b8d9ba05 to your computer and use it in GitHub Desktop.
Save letusfly85/f22e96622132b8d9ba05 to your computer and use it in GitHub Desktop.
# encoding: utf-8
str = "
abc
def
ghi
jkl
mno
pqr
stu
"
#改行以外を抜き出す
result = str.scan(/([^\n]+)/)
print result
# アウトプットはWindowsで以下
#
# [["abc"], ["def"], ["ghi"], ["jkl"], ["mno"], ["pqr"], ["stu"]]
#
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment