Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

fix escaping of exclude arg #35

Open
wants to merge 2 commits into
base: 0.3.0
Choose a base branch
from

Conversation

yufukui-m
Copy link

we need to more escape backslashes

irb(main):001:0> name = 'foobar'
=> "foobar"
irb(main):002:0> re = Regexp.new("\A#{Regexp.escape(name)}\z")
=> /Afoobarz/
irb(main):003:0> re.match('foobar')
=> nil
irb(main):004:0> re.match('Afoobarz')
=> #<MatchData "Afoobarz">
irb(main):005:0> re = Regexp.new("\\A#{Regexp.escape(name)}\\z")
=> /\Afoobar\z/
irb(main):006:0> re.match('foobar')
=> #<MatchData "foobar">

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant