re = /\b(?:v(?:s?\.|:)?)\s*(.*)/
str = 'Zinaida Shumilina et al. v. Belarus
CCPR/C/120/D/2142/2012
K.E.R. vs. Canada
CCPR/C/120/D/2196/2012
Lounis Khelifati v Algeria
CCPR/C/120/D/2267/2013"
Hibaq Said Hash v. Denmark
CCPR/C/120/D/2470/2014"
Anton Batanov v. Russian Federation
CCPR/C/120/D/2532/2015"
S. Z. v. Denmark
CCPR/C/120/D/2625/2015"
'
# 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