re = /'([\p{L}]+)/m
str = '\'가락시장(340)\',
\'가락시장(8)\',
\'가산디지털단지(7)\',
\'강남(222)\',
\'강남구청\',
\'강동\',
\'강동구청\',
\'강변(214)\',
\'개롱\',
\'개화산\',
\'거여\',
\'건대입구(212)\',
\'건대입구(7)\',
\'경복궁(317)\',
\'경찰병원(341)\',
\'고덕\',
\'고려대\',
\'고속터미널(329)\',
\'고속터미널(7)\',
\'공덕(5)\',
\'공덕(6)\',
\'공릉\',
\'광나루\','
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html