The SEQ_REGEXP Tag
Prev | Chapter 10. Mode Definition Syntax | Next

## The SEQ_REGEXP Tag

The `SEQ_REGEXP` rule is similar to the `SEQ` rule except the match sequence is taken to be a regular expression. In addition to the attributes supported by the `SEQ` tag, the following attributes are supported:

- `HASH_CHAR` - a literal string which must be at the start of a regular expression.

- `HASH_CHARS` - a list of possible literal characters, one of which must match at the start of the regular expression.

`HASH_CHAR` and `HASH_CHARS` attributes are both optional, but you may only specify one, not both. If both are specified, `HASH_CHARS` is ignored and an error is shown. Whenever possible, use a literal prefix to specify a `SEQ_REGEXP`. If the starting prefix is always the same, use `HASH_CHAR` and provide as much prefix as possible. Only in rare cases would you omit both attributes, such as the case where there is no other reliable way to get the highlighting you need, for example, with comments in the Cobol programming language.

The regular expression match cannot span more than one line.

Regular expression syntax is described in Appendix E, Regular Expressions.

NOTE: c-style character escaping for literals (such as the tab char: \t) do not work as attribute values in XML. Use the XML character entity instead. For example: &#09; instead of \t.

Here is a `SEQ_REGEXP` rule from moin.xml that uses the `HASH_CHARS` attribute, to describe a keyword (wikiword) that can start with any uppercase letter and contain lower case letters and at least one uppercase letter in the middle.

     		<SEQ_REGEXP HASH_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZ" AT_WORD_START="TRUE"
     		TYPE="KEYWORD2">[A-Z][a-z]+[A-Z][a-zA-Z]+</SEQ_REGEXP>

Prev | Up | Next
The SEQ Tag | Home | The IMPORT Tag