I am trying to find a regex that matches any string with two consecutive backslashes. I’m trying every variation, any help? And info on handling backslashes
b='\\mystring'
if b=~/\\\\/
puts "it matches"
end
I can’t seem to get this to match.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your regex looks good, but your string does NOT contain two backslashes, it just contains one. It looks like it contains two but that’s only in your source file, not in the actual string. Try this: