s = "-#test--#"key = "test-"rx = /(?<!\w)#{Regexp.escape(key)}(?!\w)/puts (s =~ rx) != nil
Standard input is empty
true
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!