This commit is contained in:
Roberto Alsina 2024-08-08 12:35:34 -03:00
parent ce63fe31e9
commit 9709bbf62f

View File

@ -136,30 +136,13 @@ module CRe2
end
end
re = CRe2::Regex.new(".*(x).*", Regex::Options::ANCHORED | Regex::Options::MULTILINE)
m = re.match("axb")
p! m.try &.[0]
p! m.try &.[1]
# re = CRe2::Regex.new(".*(x).*", Regex::Options::ANCHORED | Regex::Options::MULTILINE)
# m = re.match("axb")
# p! m.try &.[0]
# p! m.try &.[1]
re = Regex.new(".*(x).*", Regex::Options::ANCHORED | Regex::Options::MULTILINE)
m = re.match("axb")
p! m.try &.[0]
p! m.try &.[1]
# re = Regex.new(".*(x).*", Regex::Options::ANCHORED | Regex::Options::MULTILINE)
# m = re.match("axb")
# p! m.try &.[0]
# p! m.try &.[1]
# match = Pointer(LibCre2::StringPiece).malloc(10)
# opts = LibCre2.opt_new
# LibCre2.opt_posix_syntax(opts, true)
# LibCre2.opt_longest_match(opts, true)
# LibCre2.opt_perl_classes(opts, true)
# LibCre2.opt_encoding(opts, 1)
# # LibCre2.opt_one_line(opts, false)
# # LibCre2.opt_never_nl(opts, false)
# pattern = "(\\s+)(foo)"
# text = " foo"
# re = LibCre2.new(pattern, pattern.size, opts)
# p! LibCre2.match(re, text, text.size, 0, text.size,
# LibCre2::CRE2_ANCHOR_START, match, 10)
# (0...10).each do |i|
# p! String.new(Slice.new(match[i].data, match[i].length))
# end