5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/caixanegra/api/designer/inputs_controller.rb', line 5
def evaluate_regex
full_match = sample.match(Regexp.new(expression, Regexp::IGNORECASE))
direct = { "_full": full_match.to_s, "_expression": expression }
captures = {}
(full_match&.captures || []).each_with_index do |capture, index|
captures["c#{index}"] = capture
end
named_captures = full_match&.named_captures || {}
render json: direct.merge(captures).merge(named_captures).symbolize_keys
rescue RegexpError
head 422
end
|