I'm trying to match a particular path pattern for an autocommand. I have this:
au BufRead *.md if expand('<amatch>') =~ "/path/to/dir/[0-9]"
It successfully matches, eg.
c:\soemthing-or-other\path\to\dir\790-798-testing\790-798-testing.md
However, I cannot better refine the match: eg,
au BufRead *.md if expand('<amatch>') =~ "/path/to/dir/[0-9]\{2\}"
au BufRead *.md if expand('<amatch>') =~ "/path/to/dir/[0-9]*\.md$"
au BufRead *.md if expand('<amatch>') =~ "/path/to/dir/\d*\.md$"
au BufRead *.md if expand('<amatch>') =~ "/path/to/dir/\d"
All of the above fail. Why? What am I doing wrong? Is there something about regex patterns in autocommands I'm missing?
/testing/[0-9]
and/testing/[:digit:]
, but most others don't?:h expr-quote
and:h literal-string