I have this regex: ^\/\*
to check and see if a file contains those two characters at the beginning. I'm iterating over many c++ source files trying to see which of them contain that. The problem is, that if a file contains this:
#include <source.h>
/* this is a comment */
this also matches the regex. I don't understand why, as the regex doesn't have the multiline flag on.
Here's the code for the regex:
multi = /^\/\*/
Why isn't this matching only at the beginning of the text? Here's basically everything I'm doing:
data = File.read(filename)
if data =~ multi
puts "file starts with multiline header"
end