in reply to Regex Update: Chapters 1-3 rough draft

The preface will explain how much Perl the reader is expected to know, right?. Given the topic, I suggest that you assume they haven't worked with Perl regular expressions at all, in which case you should explain the s and m operators before you use them.

You don't have to spend a lot of time at it, but when I see "Learning..." in the title of a book, I expect the basics of the subject matter to be covered early, and re-emphasized in new sections (or new contexts). In chapter 2 you could say,

Perl's m operator is used to match patterns in a string, such as
m/Hello, world!/
The / marks delimit the pattern; any of Perl's quoting or bracketting characters can be used as well, though the / is the most traditional, and in fact the m operator can be left out if you use them.

Replies are listed 'Best First'.
Re: Re: Regex Update: Chapters 1-3 rough draft
by japhy (Canon) on May 10, 2001 at 23:22 UTC
    Well, right now, I have:
    When learning a programming language, usually the first example you are taught is how to print the statement "Hello, world!" to the screen. Regexes are a language unto themselves, so it's only fitting you see how to match a string containing the phrase, "Hello, world!":
    m/Hello, world!/
    That was simple enough. But it requires some explaining; the / characters are the default regex delimiters. The m preceeding them is optional if you are using / as the delimiter. For now, we'll leave it in, but you should get used to seeing regexes without that leading m.
    I'll work in some variant of what you've said. The preface is going to be like most prefaces, with some introductory text, followed by what you're expected to know, and "conventions used in this book".

    japhy -- Perl and Regex Hacker