Module: ThemeCheck::RegexHelpers

Constant Summary collapse

LIQUID_TAG =
/#{Liquid::TagStart}.*?#{Liquid::TagEnd}/om
LIQUID_VARIABLE =
/#{Liquid::VariableStart}.*?#{Liquid::VariableEnd}/om
LIQUID_TAG_OR_VARIABLE =
/#{LIQUID_TAG}|#{LIQUID_VARIABLE}/om
HTML_LIQUID_PLACEHOLDER =
/≬[0-9a-z\n]+[#\n]*≬/m
START_OR_END_QUOTE =
/(^['"])|(['"]$)/

Instance Method Summary collapse

Instance Method Details

#matches(s, re) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/theme_check/regex_helpers.rb', line 11

def matches(s, re)
  start_at = 0
  matches = []
  while (m = s.match(re, start_at))
    matches.push(m)
    start_at = m.end(0)
  end
  matches
end