开发者

Regular Expression Please

What would the regular expression be to find all instances of the following;

file:///F|/rah/title.txt (47开发者_StackOverflow of 199) [8/27/03 11:21:39 PM]</p><p class="Griegs3">
file:///F|/rah/title.txt

Where the (47 of 199) changes to (48 of 199) etc. Bu I want to match from file:// in the first line to .txt in the second

What I have been ased to do is go through around 60 files and find all instances of the above within them. There are likely to be 1000's of instances and I just wanted to be able to open notepad++ and run a macro over all the files matching and then removing the instances.


Without more information this is a bit unclear, but here's my stab at it:

file:.*\(\d+\s*of\s*\d+\).+[\r\n]*file:.+[\r\n]*

As seen on rubular

This will match the a line containing (x of y) and the line right after it.
Both lines have to start with file:.


EDIT: I tested the regex and it works. However, Notepad++ doesn't support multiline regex.
See this question.

Here's a more generic regex which will match any lines starting with file:

^file:.+[\r\n]*


/file\:\/\/\/F\|\/rah\/title\.txt\ \(47\ of\ 199\)\ \[8\/27\/03\ 11\:21\:39\ PM\]\<\/p\>\<p\ class\=\"Griegs3\"\>\nfile\:\/\/\/F\|\/rah\/title\.txt/

(blame quotemeta, not me, for the liberal escaping.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜