vlang / pcre

MIT License
35 stars 6 forks source link

get_all and get throw differing results #10

Closed ttytm closed 1 year ago

ttytm commented 1 year ago

Sounds silly as get_all uses get to gather it's results. But this is what we get.

import pcre

// match value between double quotes (don't include quotes)
r := pcre.new_regex('"(.*?)"', 0)!

s := '"hello"'
m := r.match_str(s, 0, 0) or {
    println('No match!')
    return
}

println(m.get(0)!) // "hello"
println(m.get_all()[0]) // hello