Regex to match any character except a backslash

Viewed 26403

How can i say "all symbols except backslash" in Ruby character class?

/'[^\]*'/.match("'some string \ hello'")  => should be nil

Variant with two backslashed doesn't work

/'[^\\]*'/.match("'some string \ hello'")  => 'some string \ hello' BUT should be nil
3 Answers
Related