re = /(?<=\))(.+?)(\d\/\d{4}.*)/m
str = 'Cloud Innovators Solution (9 months)Social Media Marketing Specialist1/2020 - 10/2020
StoriCamPK (less than a month)Marketing Communications Manager7/2022
Coleman Estate Agents (13 years, 11 months)Director8/2009
Coleman Estate Agents NewYork (13 years, 11 months)Director8/2009
TCS (less than a month)Head of Search Engine Optimization ➤ Brand & Strategy || Go-to-market Strategy || Content Marketer8/2010
Collins Securities Pty Ltd (less than a month) Credit ManagerInvalid date
'
# 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