NOTE: Special thanks to Jacob Farmer from Identity Management who helped extensively with the regular expression portion of this post.
If you missed the Adobe Infoshares with Adobe Senior Solutions Engineer Tim Plumer on Tuesday and Thursday, you missed a lot of great information. Even someone like me, who thinks they know everything learned a thing or two about a thing or two.
One of the things that jumped out at me was GREP Styles in InDesign. If you’re not familiar with grep(traditionally spelled in all lower case on UNIX-based systems, but listed in capital letters in InDesign), it’s a pattern matching tool used mainly in UNIX, but InDesign has added it’s functionality to the Paragraph styles panel. grep allows us to search for a piece of text within a file, like so:
grep Adobe indesign.txt
The line above would search for the word “Adobe” inside the text file called “indesign.txt”. Things get much more complicated when we involve regular expressions. Regular expressions allow us to search for more specific information by including various symbols within the text. For example:
grep ^Adobe
Would search for the word Adobe, but only at the beginning of a line(indicated by the ‘^’ symbol). This is an incredibly simple example, and regular expressions are almost a programming language unto themselves. For example:
\b(\w+)\s+(\1)\b
This regular expression will match duplicate words separated by any amount of whitespace. Often times, regular expressions are described as “Write once, read never” because they are so difficult to decipher once they are complete.
So why would an InDesign user care?
(more…)