Surrounding the first line of text with delimiters

General discussions about Advanced Find and Replace
Post Reply
frankm
Posts: 3
Joined: Fri Mar 02, 2007 1:10 am

Surrounding the first line of text with delimiters

Post by frankm »

I'm sure this is probably easy for someone who is an expert in regular expressions....unfortunately, I'm not.

I have about 1,000 text files in a folder.

I want to surround the first line of text only in each file with the following delimiters #TITLE# and #/TITLE#

e.g. if the first line of a text file is "This is the title", I want the first line to now read "#TITLE#This is the title#/TITLE#".

Thank you in advance,
Frank

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Exactly. It's quite simple task.

Go to main menu - Action - Options - Batch Replace
uncheck "Modifier S"
uncheck "Modifier G"
check "Modifier M"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
\A(.*)$

Replace with:
#TITLE#$1#/TITLE#

That's all I verified it works perfectly.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply