首页 > 解决方案 > 如何删除 Sublime Text 3 中所有包含撇号的单词

问题描述

标签: grepsublimetext3

解决方案


You could use a character class['’] to match both variations of the apostrophes and match zero or more times a non-whitespace character \S* before or after the matched apostrophe followed by optional horizontal white-space chars.

\S*['’]\S*\h*

Regex demo


A slightly more optimized version without preventing the first \S* causing backtracking could be using a negated character class [^\s'’]* to match until the first apostrophe.

[^\s'’]*['’]\S*\h*

Regex demo


推荐阅读