5.4.14. The RegularExpression Class
This entry defines the new method. All examples use the new method. But the definitions and syntax diagram all say init. Figure 5.38 also says init.
The description says:
"See the introductory text below for a description of the syntax."
The text ABOVE 22.214.171.124 documents patterns, and it's not until example 3 for the parse method that MINIMAL and MAXIMAL are used. Parse example 3 is a good example for both New and Match, but it doesn't use parse, thus making it a bad example of how to use parse.
Syntax diagram is missing a right parenthesis.
"This method creates the automation used to match a string"
It's not clear to me what that's trying to say.
Example 1 is missing continuation characters and would not really work. It should use - to avoid the ,, at the end of the lines.
All patterns in examples are hard coded literal strings. Example 1 shows expected output, but nothing could lead to "Error" e "occurred!". Thus, it does not show why parse would be used there instead of ~new(...)
Example 2 uses essentially the same code twice, but with different hard coded patterns, in order to show both New and Parse at work. If the example were a routine and the patterns were passed as parameters, it would be clear why Parse makes sense. It could also have a real example that causes "invalid regular expression!"
There's also no example of that method that returns the pattern associated with a RegularExpression object. You know the one I mean, right?