假设这样的文本
```
find ~ -regextype posix-extended -iregex '.*/[^/]{3,}.pdf'
```
You should also escape the `.` so that it matches “.” rather than any character:
```
find ~ -regextype posix-extended -iregex '.*/[^/]{3,}\.pdf'
```
The regular expression can be simplified since we only care about three non-“/” characters:
```
find ~ -regextype posix-extended -iregex '.*[^/]{3}\.pdf'
```
我想在开头的```
中添加语言注释如果是python随附的,则很容易实现
import re
re.sub(r"```([^`]+)```, r```bash\1```, text)
如何在vim中应用这样的正则表达式。
答案 0 :(得分:1)
在vim中,您可以执行以下操作:
%s/\v(^```)(\_.{-}```)/\1bash\2/g
这要求
```
是配对的。 (与您的python子目录相同)