Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Closed Points: 125 Time: 14:20 - Sep 13, 2006  

mary2

How do I add similar text to the beginning of every line in textpad without doing it one at a time?

I have a textpad document where I am editing my HTML code. If I need to go through a portion of text and add something like ( pagebody=' ), is there a way to do this without having to just use the paste function and manually go through every line and paste? Also, how do I add similar text to the END of every line also?

Answer Discussion
Tutorials

 

rcastagna

Date:: Sep 13, 2006

Time:: 16:11

I'm not familiar with Textpad - I use Notepad ++ for this type of chore - but check to see if TextPad will support doing a Find/Replace using a Regular Expression pattern, or look to a deditcated piece of RegEx software such as Regex Suite.

You can create your pattern that will key off of the CR/LF found that the end of each line in the document (assuming, of course, there is a CR/LF at the end of each line) to "wrap" that CR/LF with the new code you want.

I'm not a huge RegEx guy but this should work:
Find: \r?\n
Replace with: DesiredEndofLine\r\nDesiredBeginningofLine

I hope this helps...a good site for learning about Regular Expressions is RegularExpressions.Info http://www.regular-expressions.info

Take care,
Ric

mary2

Date:: Sep 15, 2006

Time:: 18:11

Tried that out but it just gave me a an error that said "Cannot find literal string \r?\n". I also tried it with just "\r\n" because I wasnt sure if that question mark was a typo but it had the same response.

mary2

Date:: Sep 18, 2006

Time:: 14:31

I found in textpad you can put a ^ to replace all items at the beginning of the line and then $ for the end, but for some reason if there is an ampersand in the text you are trying to insert, it doesnt get inserted. Example.


search: $
replace with: " &myCrLf

It puts " myCrLf at the end of every line but leaves out the &, any thoughts on this. Fixes?




rcastagna

Date:: Sep 18, 2006

Time:: 18:21

John,

Try:
search: $
replace with: " !myCrLf

and then go back and try:
search: !
replace with: &

Or, look to see if you can "escape" a character...it might be treating that & symbol as a special character like it's treating the $ and the ^

I hope this helps,
Ric

rcastagna

Date:: Sep 19, 2006

Time:: 04:15

John,

Or, you could switch over to Notepad which doesn't treat the & as a special character and do the second pass on the replace. I know...a long way to get to where you want to go, but it may be the only way.

Ric

mary2

Date:: Sep 19, 2006

Time:: 10:07

Hey rcastagna,

Your response really helped a lot. It was required to do a second pass, just had to make sure that Regular Expressions was checked on the first pass and then unchecked on the second one.

I finally did a

search: $
replace with: " &myCrLf

WITH the regular expressions activated

and then went back and did a:
search: " myCrLf
replace with: " &myCrLf

with them not activated. Worked like a charm.

alooka

Date:: Jan 28, 2010

Time:: 18:28

WOW this is almost 4 years old post.

Any way, I was looking for the same thing and I got it so let me share it for any future searcher...

You can use notpad2 ( an open source code editor) in the edit menu>Block modify lines

you can add at the beginning and end

Question Answered

This question has been closed, and points have been rewarded to the following experts:


rcastagna: 125

You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

No tutorials have been submitted yet. Want to be the first?

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

10354

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4848

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es