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.
Use this Regular expression
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):
Use this Regular expression
Delete Opening And Closing Tags But Keep Their Content
Delete ALL the tags, leaving behind only their content:
Use this Regular expression
Which results in:
Removing Blank Lines
To remove all blank lines from a file that contain no spaces or characters
Use this Regular expression
Which results in:
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:
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
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.
Use this Regular expression in 'Find what:'
Enter this in 'Replace with;"
Which results in:
Add A Tag Pair To Every Line
Here we want to wrap every line with paragraph tags.
Use this Regular expression in 'Find what:'
Enter this in 'Replace with;"
\1
Which results in:
A line
Another line
Random line
Fourth line
Fifth line
Last line
Delete Everything Between Two Tags But Keep The Tags
To remove any content located between span tags
Use this Regular expression in 'Find what:'
Enter this in 'Replace with;"
Which results in:
Change Position Of First Word To Last Word
Modify the order of a list of Last:First names to First:Last
Use this Regular expression in 'Find what:'
Enter this in 'Replace with;"
Which results in:
Add A Word Or Character To The End Of Every Line
In this example, we want to append every line with a comment
Use this Regular expression in 'Find what:'
Enter this in 'Replace with;"
Which results in:
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.