我正在寻找一个函数,它将尝试查找并返回正则表达式匹配的内容,\\(\\S-\\)如果没有找到则可能为nil.搜索应从(point)文档的末尾开始并搜索到文档的末尾.
使用re-search-forward和match-string:
(when (re-search-forward "\\(\\S-\\)" nil t)
(match-string 1))
Run Code Online (Sandbox Code Playgroud)
如果您不想要移动点,请将其包装在save-excursion:
(save-excursion
(when ...
Run Code Online (Sandbox Code Playgroud)