From: Kenichi Kamiya Date: 2012-02-27T20:01:01+09:00 Subject: Re: Find a substring in a string ":" did not match the line "Hello World", then "/^(?:#{HELLO}):\s+(.*?)$/" is not match too. Try this code if /^(?:#{HELLO}):\s+(.*?)$/ =~ "Hello: World" # Appendix I try to describe the pattern "/^(?:#{HELLO}):\s+(.*?)$/". 1. "(?:)" has no meaning in this pattern change to "/^#{HELLO}:\s+(.*?)$/" 2. "?" has no meaning in this pattern change to "/^#{HELLO}:\s+(.*)$/" 3. "$" has no meaning in this pattern change to "/^#{HELLO}:\s+(.*)/" 4. "(.*)" set $1 change to "/^#{HELLO}:\s+.*/" if you were not using $1 5. ".*" has no meaning in this pattern change to "/^#{HELLO}:\s+/" -- Posted via http://www.ruby-forum.com/.