Some stuff that didn't seem to fit in anywhere else.
The first section is some stuff I learned while doing tech support, about print drivers and some odd things you can do with them. The section on regular expressions dicusses a "power user" tool for text searches, and I hope provides enough information so you can decide if you want to try to learn regexes or not.
Whenever you buy a printer for a PC, there will generally be an install CDROM that comes with it. That CD installs the print driver for that make and model of printer. The print driver is system software that defines, controls, and facilitates the communication between the printer and your operating system and installed software, and allows you to control special features of that particular printer.
A PC with more than one printer connected will have a driver installed for each printer. Some drivers support more than one printer model. You can see what printer drivers you have installed by going to Start, Settings, Printers (or maybe Start, Settings, Control Panel, Printers). This should open a Printers window containing an Add Printer icon, plus one printer icon for each installed printer. One of the printer icons will have a little check-mark symbol next to it; that's the system default printer, which is used unless you specify something else.
If you're in a corporate environment and do some or all of your printing on a shared network printer, you should probably be cautious about changing any configuration settings of your printer icons, or you may end up needing a visit from your friendly local computer geek to fix it. Shared printers install like any other printer, except for one step in which you specify if the printer is connected to a local port on your PC or else how to find it on the network.
Even without any changes in fonts/margins or the like, results in details like automatic line and page breaks are likely to come out a little differently depending on which printer driver and printer is in use. A document which just fits on one page using one particular printer/driver will often print as two pages on something else.
When you print from most programs using a keyboard shortcut (Control-P) or a toolbar button, the system prints the displayed document on the default printer using the default settings, without bothering you about any details.
When you do File, Print instead, you should see a Print dialog box including some options for things like which pages to print and how many copies. The top of that Print dialog will have a Printer section with a Name drop list and a Properties button. The Name list is where you can choose to use a non-default printer, when available. If you click the Properties button, everything you see after that is actually coming from the printer driver for that printer, regardless of what program you started from.
Windows comes with lots of native printer drivers, specifics depending on which Windows version you have and when it came out. If you double-click Add Printer in your Printers window, you'll come to a wizard step with two lists labeled Manufacturers and Printers, plus a Have Disk button. The two windows show all the native print drivers that come with your Windows version; the button is one of several ways you can install a print driver from a disk.
Print preview and related functions in office suites and other software usually won't work unless some sort of print driver is installed, even if the PC has no actual physical printer connected.
If no better option is available (maybe because of employer software policies) you can always go to Add Printer in your Printers window, pick Generic under Manufacturers, and Generic/Text Only under Printers. That should at least get your print preview and page break features working. Of course, they may not resemble the results on any real printer very much.
Perhaps your PC has no physical printer access, but your documents are normally printed somewhere else on a particular type of printer. You can look in Add Printer under the manufacturer and see if Windows has a native driver for that printer model. If it doesn't have that exact model, you may be able to select a similar model, and see preview results that will be close to the actual results.
One excellent option for almost anyone without a physical printer is the free utility CutePDF Writer. It can also be pretty handy if you do have a printer. It shows up in your Printers window and in the Name list in Print dialogs as if it were a print driver, and it can even be the system default. You can "print" from any program to CutePDF Writer, and it will create an Adobe PDF file on disk, wherever you choose. You can print the PDF file on paper later if you need to, on any PC with a physical printer and free Adobe Reader (formerly known as "Acrobat Reader") including PCs at public libraries and Fedex Kinko's stores. CutePDF Writer can be especially useful for documenting online purchases and other significant Web transactions.
There are other applications which emulate a print driver in this manner, but aren't associated with any physical printer. If you purchase the PDF-file editing software Adobe Acrobat, I understand it comes with a module called Distiller which does essentially the same thing as free CutePDF Writer. There's also commercial fax software, for sending and receiving faxes on a modem-equipped PC, in which one way to send a fax is to "print" to a similar module.
You can install any print driver you want as a secondary or non-default printer, as long as you don't try to actually print to it. Printer manufacturers nearly all make their drivers available free on the Internet, partly because people lose their driver disks. If you use a particular make and model printer at work, you can install a driver for the same model at home for previewing. If you print to a variety of laser or inkjet printers in different locations, you can pick a typical example and install that driver.
When I was doing Microsoft Excel tech support, I'd found a driver on the Hewlett-Packard site that supported a dozen of their more common page plotters. I usually kept that installed on one or both of my PCs, because it was helpful when discussing printing and previewing issues with customers with plotters, even though I didn't actually have one.
This is not a regular expressions tutorial. This is about what they're like, what they're good for, and where to get more information if you decide to learn to use them, including links to tutorials.
If you've been using PCs for a while, you may know that at a DOS prompt you can type dir *.doc to see a listing of all the Word DOC files in the current directory. The asterisk in the command is called a DOS wildcard, and matches any number of characters appearing instead of itself in a real filename, in this example matching any filename of any length that has the extension doc.
You may also have used Word's extended search and replace feature that allows you to search for text strings including special characters such as tab characters and carriage returns.
Regular expressions (sometimes regex for short) refers to an advanced type of text search that is related to both those ideas, and is only supported in certain applications. Some people are intimidated by regular expressions and don't attempt to use them, including me until pretty recently.
Fundamentally, regular expressions is a more complicated and powerful system for search strings, using normal characters and metacharacters.
Ordinary characters in regular expressions are the same as in any search string: they just stand for the character itself. Metacharacters either stand for a special character or condition (such as the beginning or end of a text line) or let you define more complicated specifications for search characters. Applications and systems vary somewhat in which advanced metacharacters they support; consult the regex documentation for whatever you're working with.
Here are the most basic metacharacters:
. Match any single character
$ Match end of line
^ Match beginning of line
* Match zero or more occurrences of character preceding
\ Treat following character as ordinary character
[] Define list or range of characters
Regular expression search is supported in the text editors Notepad++ and Notepad2, useful for HTML/CSS editing, and in many other text editors and programmer's editors, and in the OpenOffice.org word processor Writer, which can open, edit, and save document files in Microsoft Word DOC format.
I believe regular expressions on computers originated in the Unix operating system. Unix/Linux tools that support regular expressions include sed and awk, the text editors vi and emacs, the text search tool grep, and the programming languages perl, Python, Java, PHP, c, and c++.
Different applications support regexes to different degrees. Some applications support a form of regex in which you can specify not only text to search for but text to replace it with. This can be very powerful.
Notable places where regular expressions could be supported but aren't would include Microsoft Word text searches, the Microsoft Windows Find utility, and Web-browser page-text searches. Admittedly the average user isn't going to miss them, but it would be nice to make them available for power users, perhaps more so in Word and Windows Find than in browser text search.
If you enclose a list or range of characters in square brackets as part of a regular expression, that will match any single occurrence of any of the characters in the list or range. If the first character inside a list in brackets is a caret (^) signifying negation, that part of the expression will match any single character that's not in the list. The regular expression c[aou]t (a list example) will match cat, cot, and cut in the text being searched. The square brackets and caret are metacharacters in the regular expressions syntax.
Common expressions using a range of characters would include [a-z], [A-Z], and [0-9], which will respectively match any lower-case letter, any upper-case letter, and any digit. Ranges can also be negated with a caret; [^0-9] will match any character that's not a digit.
When the text you need to search for includes characters that are defined as regex metacharacters, you can still search for them as regular text characters, but they must be quoted in your search string, by being preceded with the metacharacter backslash (\). You can even search for a backslash by quoting it with another one (\\).
My first regex happened because I had leftover quote characters in my Web-page text outside of tags, and I wanted to find them all and replace them with the unambiguous HTML named character entity ". It was necessary to look for quote characters outside HTML tags because many HTML tags use quotes to delimit attribute values.
The seven-character regular expression I used was:
>[^<]*"
... which in English means "find all cases where a right angle bracket (first character) followed by zero or more characters none of which is a left angle bracket (middle five characters) is followed by a quote character (last character)." Notepad++ let me run that recursively against all HTML files in my local-drive Web directory. It worked.
I had been using two hyphens (--) as a substitute for an em dash (—) in these pages, an old typescript convention, because a reference I was using identified the character entity for the real em dash as deprecated. In January 2008 I used a variation on the above example, to find them all and replace them with the named character entity —. It was necessary to look outside HTML tags in this case because HTML comments also use double hyphens.