更新时间:2022-11-30 11:57:15
它是 \\\`
用于开始缓冲区或字符串。而 \\'
为结束。请参阅手册
It's \\`
for beginning of buffer or string. And \\'
for end. See manual
但是,我认为你的耻辱的根源不是锚点。 char类根据当前语法表匹配不同的字符, [:space:]
要可靠地匹配非打印或打印字符,请使用 [:graph:]
。请参阅 char class
However, I think the root of your confustion isn't the anchor. The [:space:]
char class matches different characters based on the current syntax table. To reliably match a non-printing or printing character use [:graph:]
. See char class
另外。
不会匹配换行符。
例如$($)
E.g.
(let ((str " \n a\nbc \n "))
(string-match "\\`[^[:graph:]]*\\(\\(?:.\\|\n\\)+?\\)[^[:graph:]]*\\'" str)
(match-string 1 str))