tags:

views:

63

answers:

2

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.

A: 

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]*
NullUserException
Thanks for this but I have updated the question so that it hopefully makes more sense
griegs
@griegs: it doesn't.
sreservoir
@NullUserException, 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
A: 

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

sreservoir
'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
...good job understanding the point.
sreservoir