Module: SwedbankPay::RegexCaptureFilter
- Defined in:
- lib/regex_capture_filter.rb
Overview
Adds a ‘regex_capture’ filter to Liquid. Performs a regular expression match on the provided string and returns the capture as an array. Example usage: html | regex_capture: ‘id=“(+)”’ | first }
Instance Method Summary collapse
Instance Method Details
#regex_capture(str, regex) ⇒ Object
11 12 13 14 |
# File 'lib/regex_capture_filter.rb', line 11 def regex_capture(str, regex) match = /#{regex}/.match(str) match ? match.captures : [] end |