我有一个bash脚本,它使用inotifywait复制在目录中创建的文件。
但它正在复制我不想要的vim临时文件。
例如,如果我创建foo.txt并在vim中编辑它,我最终会得到以下部分/全部:
foo.txt~
.foo.txt.swp
.foo.txt.swx
4913我正在尝试编写正则表达式来匹配它们,这就是我到目前为止所得到的:
'^\*\.sw??$'我希望这至少会匹配swp和swx文件,但它不是。
发布于 2012-11-18 02:09:31
^.+?\.sw.?$说明:
^ Start of string
.+? - Matches any character 1 or more (non greedy)
\. - matches literal .
sw.? - Matches sw followed by 1 character
$ - End of string发布于 2012-11-18 02:08:48
尝试此正则表达式
^.+\.sw[px]$https://stackoverflow.com/questions/13433278
复制相似问题