O'Reilly logo

Text Processing with Ruby by Rob Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example: Parsing RTF Files

Rich-Text Format (RTF) files have long and storied history. First introduced in 1987 with Microsoft Word 3, RTF became the default file format of many word processors in the intervening years. It’s still the default format of TextEdit in Mac OS X, for example, almost thirty years after its introduction. Since it allows for a wide variety of formatting and is a standard, well-understood, and lightweight file format, it’s still common to find data stored in RTF format.

While these files are admittedly less common in the wild than, say, .doc files, their structure is also much simpler. It’s fundamentally a plain text format, peppered with the occasional instruction to define some element of the text’s formatting—its color, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required