re = /(if ?\(.*(?P<v1>\bvariavel\b))|(^let (?P<v2>variavel) = )|^[\t ]*?(?P<v3>variavel)[. ]|\(.*?(?P<v4>\bvariavel\b).*?\)|(.*?\$\{.*?(?P<v5>\bvariavel[. ]?\b))|(.*?[\'\"]\s*?\+\s*?\b(?P<v6>variavel)\b)+?/m
str = 'if(variavel == true)
if(modelo == variavel)
let variavel = "asduasdtu"
variavel = true
variavel.adsahg = "ghhjgkhjg variavel "
variavel.fn(variavel)
`${alguma coisa variavel.
\'ashgdjas" + variavel.asdkjhk + sdjkahkld" + variavel'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html