Created
November 4, 2016 01:02
-
-
Save da3mon/1d1da7effb86e5db634a0aaaf9407740 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rspec' | |
describe 'flip flop ragerts' do | |
it 'matches stuff between the same thing' do | |
text = %{here's some {code} text that is gross {code} and shouldn't be done} | |
res = text.split.inject([]) { |a, t| a << t if t =~ /{code}/ ... t =~ /{code}/; a }.join(' ') | |
expect(res).to eq(%{{code} text that is gross {code}}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment