HPlogo System Debug Reference Manual > Appendix A Patterns and Regular Expressions

Metacharacters

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

In order to express more general patterns than just literals, some specific characters have been defined. For example, the character "." as a regular expression matches any single character. The regular expression "a.b" matches "a+b", "aZb", and similar strings.

The "." and other reserved characters are called metacharacters. The special meaning of any metacharacter can be turned off by preceding it with the escape character "\". Thus, "\." matches the literal period character and "\\" matches the literal backslash.

Two positional metacharacters exist. "^" matches the beginning of a line: "^HP" is a regular expression that matches "HP" only if it occurs as the first two characters of the line. Similarly, "$" matches the end of a line: "HP$" matches "HP" only if it is the last thing on a line. Of course, these can work together: "^HP$" matches a line that contains only "HP".




Literal Expressions (Match Exactly These Characters)


Character Classes (Match Any One of the Following Characters)