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

## The EOL_SPAN_REGEXP Tag

The `EOL_SPAN_REGEXP` rule is similar to the `EOL_SPAN` rule except the match sequence is taken to be a regular expression. In addition to the attributes supported by the `EOL_SPAN` 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 `EOL_SPAN_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.

Here is an `EOL_SPAN_REGEXP` that highlights MS-DOS batch file comments, which start with `REM`, followed by any whitespace character, and extend until the end of the line:

    <EOL_SPAN_REGEXP AT_WHITESPACE_END="TRUE" HASH_CHAR="REM" TYPE="COMMENT1">REM\s</EOL_SPAN_REGEXP>

Prev | Up | Next
The EOL_SPAN Tag | Home | The MARK_PREVIOUS Tag