0

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

file:///F|/rah/title.txt (47 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.

griegs
  • 22,624
  • 33
  • 128
  • 205

2 Answers2

0

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]*
Community
  • 1
  • 1
NullUserException
  • 83,810
  • 28
  • 209
  • 234
  • Thanks for this but I have updated the question so that it hopefully makes more sense – griegs Oct 01 '10 at 01:31
  • fat chance of me actually getting them to purchase anything at this place! :) But thatks for the heads up, it makes some sense and maybe i can run two macros in notepad++ one after the other – griegs Oct 01 '10 at 02:19
0

/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.)

muhmuhten
  • 3,313
  • 1
  • 20
  • 26
  • '47 of 199' changes for each instance so the next one will be '48 of 199' and so on so i need that bit to be ignored – griegs Oct 01 '10 at 01:36