re = /(.*\d*[13579]\.article)|(.*[a-d|[f-m]$)/m
str = '*** Match odds or A-M
(.*\\d*[13579]\\.article)|(.*[a-d|[f-m]$)
https://edu.rsc.org/science-research/salt-crystal-grows-legs/4012581.article
edu.rsc.org/45.article
edu.rsc.org/weuvkee/a
edu.rsc.org/weuvkee/f
****** Don\'t match
https://edu.rsc.org/ideas/5-ways-to-explain-titration/4012500.article?utm_source=house-list&utm_medium=email&utm_campaign=monthly-alert
https://edu.rsc.org/feature/making-materials-from-biomass/4012606.article
https://edu.rsc.org/eic/classroy
https://edu.rsc.org/wibble/chips/stuff/science
edu.rsc.org
*** Match evens or N-Z
(.*\\d*[02468]\\.article)|(.*[n-z]$)
https://edu.rsc.org/ideas/5-ways-to-explain-titration/4012500.article?utm_source=house-list&utm_medium=email&utm_campaign=monthly-alert
https://edu.rsc.org/feature/making-materials-from-biomass/4012606.article
https://edu.rsc.org/eic/classroy
https://edu.rsc.org/wibble/chips/stuff/science
****** Don\'t match
https://edu.rsc.org/science-research/salt-crystal-grows-legs/4012581.article
edu.rsc.org/45.article
edu.rsc.org/weuvkee/a
edu.rsc.org/weuvkee/f'
# 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