I'll be posting my weekly status report every wednesday evening (or maybe not). I've got chapters 1 to 3 done in rough draft form. If you have any comments, critiques, questions or suggestions, feel free to email me (please don't leave me a /msg, it's easier to collect emails). Chapters 2 and 3 have exercises, and Appendix A has solutions to the exercises. Let me know what you think about the "puzzles", and if chapter 2 should have some.

Learning Perl Regular Expressions, Ch. 1-3

japhy -- Perl and Regex Hacker

Replies are listed 'Best First'.
Re: Regex Update: Chapters 1-3 rough draft
by MrNobo1024 (Hermit) on May 10, 2001 at 08:08 UTC
    In the section about word boundaries, you said that "teddie" =~ /ed/; is false. Why dosen't it match? It looks like it should...
      Be carreful japhy, if you make mystake in tutorial... ;)
      I found your project very good, because I love regexp and I want to play with it.

      BoBiOne KenoBi ;)

      That was a copy-and-paste error. But thank you for pointing that out. Typos in a regex tutorial will be terribly difficult for any non-Perl-knowing editor to find.

      I WILL be testing all code in this book.

      japhy -- Perl and Regex Hacker

Re: Regex Update: Chapters 1-3 rough draft
by TheoPetersen (Priest) on May 10, 2001 at 23:07 UTC
    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.

      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
(bbfu) (suggested metacharacter) Re: Regex Update: Chapters 1-3 rough draft
by bbfu (Curate) on May 11, 2001 at 04:08 UTC

    I'd like to suggest that you include the backslash in your list of metacharacters at the begining of Chapter 2.

    You discuss using the backslash to escape the special meaning of metacharacters but don't mention that you need to escape a backslash itself to match it.

    Very good job so far! :-)

    bbfu
    Seasons don't fear The Reaper.
    Nor do the wind, the sun, and the rain.
    We can be like they are.