Failing to match \\ in the beginning of the string
Closed this issue · 2 comments
racinmat commented
I want to match e.g. \\t
string, with 2 backslashes and one letter after it. With regexps, it can be easily done, but I fail to replicate it with Automa.jl.
This is my code, matcha(data) should return true, but returns false instead.
Occursin returns true as expected.
dat = raw"\\t"
occursin(r"^\\\\t$", dat)
machine = Automa.compile(re"\\\\t")
context = Automa.CodeGenContext(generator=:goto, checkbounds=false)
@eval function matcha(data)
$(Automa.generate_init_code(context, machine))
p_end = p_eof = lastindex(data)
$(Automa.generate_exec_code(context, machine))
return cs == 0
end
matcha(dat)
I tried different number of backslashes in re, but nothing worked.
I'm using Julia 1.3-rc4, and automa 0.8.0.
macd commented
Just FYI, this works for me in Julia 1.5 and Automa v0.8.0
racinmat commented
Hmm, it returns true for me, tried with Julia 1.3.1 and Automa 0.8.0, so it's working as expected.