I need help decoding this regular expression from sprockets. I am not sure what this matches but if someone give give me some hints or starting points.
HEADER_PATTERN = /
\A (
(?m:\s*) (
(\/\* (?m:.*?) \*\/) |
(\#\#\# (?m:.*?) \#\#\#) |
(\/\/ .* \n?)+ |
(\# .* \n?)+
)
)+
/x
(?m:...)allows the dot inside this sub-expression also to match newline characters which is usually doesn’t. (This is a Ruby specialty; nearly all other regex flavors use(?s:...)for this)So it seems this regex matches block comments or line comments at the start of a file/string.