File: string.rb

package info (click to toggle)
ruby-re2 2.7.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,872 kB
  • sloc: ruby: 1,902; cpp: 1,165; makefile: 7
file content (36 lines) | stat: -rw-r--r-- 940 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# re2 (https://github.com/mudge/re2)
# Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to
# backtracking regular expression engines like those used in PCRE, Perl, and
# Python".
#
# Copyright (c) 2010, Paul Mucur (https://mudge.name)
# Released under the BSD Licence, please see LICENSE.txt

require "re2"

module RE2
  # @deprecated Use methods on {RE2} and {RE2::Regexp} instead.
  module String
    # @deprecated Use {RE2.Replace} instead.
    def re2_sub(*args)
      RE2.Replace(self, *args)
    end

    # @deprecated Use {RE2.GlobalReplace} instead.
    def re2_gsub(*args)
      RE2.GlobalReplace(self, *args)
    end

    # @deprecated Use {RE2::Regexp#match} instead.
    def re2_match(pattern, *args)
      RE2::Regexp.new(pattern).match(self, *args)
    end

    # @deprecated Use {RE2.QuoteMeta} instead.
    def re2_escape
      RE2.QuoteMeta(self)
    end

    alias_method :re2_quote, :re2_escape
  end
end