Project

General

Profile

Misc #9801 ยป regexp-extended-whitespace.rb

allolex (Damon Davison), 05/03/2014 02:47 PM

 
#!/usr/bin/env ruby
text = 'Expect the regex to match this'

[
'match this',
'match\ this',
'match[ ]this',
Regexp.quote('match this')
].each do |pattern|
re = Regexp.new(pattern, Regexp::EXTENDED)
puts pattern.inspect
puts (re === text).to_s
end
    (1-1/1)