public
Created

  • Download Gist
threadsafe_regexes
1 2 3 4 5 6 7 8 9 10 11
irb(main):021:0> x = "foobar"
=> "foobar"
irb(main):022:0> x =~ /(foo)/
=> 0
irb(main):023:0> $1
=> "foo"
irb(main):024:0> Thread.new { x =~ /(bar)/; puts $1}.join
bar
=> #<Thread:0x007ff47a10cb58 dead>
irb(main):025:0> $1
=> "foo"

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.