(?=re) matches re at this point but does not consume it - you can look
forward for the context of a match without affecting $&.
str ="red, white, and blue"
p str.scan(/[a-z]+(?=,)/)
the result is :
=> ["red","white"]
(?=re) matches re at this point but does not consume it - you can look
forward for the context of a match without affecting $&.
str ="red, white, and blue"
p str.scan(/[a-z]+(?=,)/)
the result is :
=> ["red","white"]