Regular expression to modify the line following a line that begins with a key phrase?
I have a huge file that has some lines that need to have a line of dashes underneath them followed by an empty line.
All of these lines start with the same particular word pattern ("Dollars required for"
) but every other word on the line is different from one line to the next.
For example, the document looks like this at the moment:
Dollars required for: "International Exchange"
Some other text on the next line
...
Dollars required for: "Trade Operations"
(blank line)
Some other text on the next line
But it needs to look like this:
Dollars required for: "International Exchange"
---------------------------------------------- (inserted line of dashes)
(inserted blank line)
Some other text on the next line
...
Dollars required for: "Trade Operations"
---------------------------------------------- (inserted line of dashes)
(inserted blank line)
(blank line)
Some other text on the next line
Is there a Regular Expressio开发者_Go百科n I could use in the Find/Replace feature of my text editor (Jedit) to perform this modification?
Find:
Dollars required for: (.*)$
Replace with:
Dollars required for: $1\n----------------------------------------------\n
(This is assuming the find/replace supports escapes for newlines, et cetera.)
Search for:
^(Dollars required for: .*)$
Replace with:
$1\n----------------------------------------------\n\n
Jedit can do it IRC.
精彩评论