TextPad Cheat Sheet

TextPad is a definite favorite for editing plain text, xml and php files, especially if you are looking for a simple, light-weight program that can open extremely large files (we recently edited a 660MB xml file).
It's equally good if you're looking for something that will remove unwanted elements from xml files and clean up empty lines afterward.
In some of these examples, we'll be using TextPad's Replace tool (F8) and selecting Regular expression under the Conditions section of the Replace dialog window, and entering our search term in the Find what: input box.
In other examples, we'll be using the TextPad's Find tool (F5), entering our text that we want to find (or using Regular expression) and selecting Mark All.  After all our lines are bookmarked, (an arrow appears on the targeted lines), we'll select Edit from the menu, then Delete, then select Bookmarked Lines.

Removing Tags And Their Content

To delete a tag along with its content.
<package>Medium box</package> <package>XLarge box</package> <package>Small box</package>...
Use this Regular expression
^<package>[^<>]+</package>$

Removing Tags With Different Attributes As Well As Their Content

If the tag contains an attribute such as name, class or style (which may vary between tags):
<span class="myClass">Medium box</span> <span class="myClassS">XLarge box</span> <span class="myClassV">Small box</span>...
Use this Regular expression
<span[^>]*?>.*?</span>

Delete Opening And Closing Tags But Keep Their Content

Delete ALL the tags, leaving behind only their content:
<name>John Doe</name> <address>123 Main St</address> <zip>12345</zip>
Use this Regular expression
<[^>]*>
Which results in:
John Doe 123 Main St 12345

Removing Blank Lines

To remove all blank lines from a file that contain no spaces or characters
Kangaroo Elephant Hippo Rabbit
Use this Regular expression
^\n
Which results in:
Kangaroo Elephant Hippo Rabbit

Removing Blank Lines With x Number Of Spaces

If the blank line has a specific number of spaces, you will need to include each space in your expression in order to remove those specific lines. To view the spaces in lines, select View from the menu and select Visible Spaces.  If our blank line has 4 spaces in it, add four spaces before the end of line code:
^ \n

Removing Blank Lines With Any Number Of Spaces

If you don't need to target a specific number of spaces, but just want to delete all blank lines that contain any number of spaces
Use this Regular expression
^ +\n

Add A Word Or Character To The Beginning Of Every Line

In this example, we want to add the word "Jokes-" to each line in our file.
A line Another line Random line Fourth line Fifth line Last line
Use this Regular expression in 'Find what:'
\(^.*\)
Enter this in 'Replace with;"
Jokes-\1
Which results in:
Jokes-A line Jokes-Another line Jokes-Random line Jokes-Fourth line Jokes-Fifth line Jokes-Last line

Add A Tag Pair To Every Line

Here we want to wrap every line with paragraph tags.
A line Another line Random line Fourth line Fifth line Last line
Use this Regular expression in 'Find what:'
\(^.*\)
Enter this in 'Replace with;"
<p>\1</p>
Which results in:
<p>A line</p> <p>Another line</p> <p>Random line</p> <p>Fourth line</p> <p>Fifth line</p> <p>Last line</p>

Delete Everything Between Two Tags But Keep The Tags

To remove any content located between span tags
<span>Some content we don't want</span> <span>More content we don't want</span> <span>Even more content we don't want</span>
Use this Regular expression in 'Find what:'
\(<span>\).+\(</span>\)
Enter this in 'Replace with;"
\1\2
Which results in:
<span></span> <span></span> <span></span>

Change Position Of First Word To Last Word

Modify the order of a list of Last:First names to First:Last
Doe John Smith Jane Williams Bob Little Felix Lee
Use this Regular expression in 'Find what:'
^\([^ ]*\) \(.*\)$
Enter this in 'Replace with;"
\2 \1
Which results in:
John Doe Jane Smith Bob Williams Felix Lee Little

Add A Word Or Character To The End Of Every Line

In this example, we want to append every line with a comment
John Doe Jane Smith Bob Williams Felix Lee Little
Use this Regular expression in 'Find what:'
$
Enter this in 'Replace with;"
// Contact Name
Which results in:
John Doe // Contact Name Jane Smith // Contact Name Bob Williams // Contact Name Felix Lee Little // Contact Name

Sticky Side Column

If you're using our PHP Website Template, this is the optional side bar column you can add to some or all of your pages. It can be useful for adding advertisements such as Adsense ads to be displayed on multiple pages.
When you include the side column, your main content will automatically adjust its width to accommodate it.
The side bar is 'sticky'; it will scroll down and remain in view.
You can turn on/off the side bar column per page by defining the $showSide option located at the top of each file.