Re: MS-FO-LC1-047: 7.5.2 fn:matches

Hi Michael,

[regarding errors in the examples of fn:matches()]
> The first one is within a line, but the strings are distributed over
> two lines.
>
> The second one is using the multi-line option, so it should find it,
> but it currently returns true. Etc.
>
> Either the examples are wrong or the description of multiline
> matching is confusing.

The behaviour for the particular examples is described in 7.5.1
Regular Expression Syntax, where it says:

  * In string mode, the metacharacter . matches any character
    whatsoever. In multiline mode, the metacharacter . matches any
    character except a newline (#x0A) character.

The first example:

  fn:matches(., "Kaum.*krähen")

is in string mode, so the metacharacter . matches any character
whatsoever, including newline (#x0A) characters. Thus it will return
true despite the fact that "Kaum" and "krähen" appear on different
lines, because the . can match the newline character between them.

The second example:

  fn:matches(., "Kaum.*krähen", 'm')

is in multiline mode, so the metacharacter . matches any character
aside from newline (#x0A) characters. Thus it will return false
because "Kaum" and "krähen" have a newline character (which can't be
matched by the .) between them.

Personally, I think that the spec is clear, but perhaps you have some
suggested wording that would make it clearer?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Wednesday, 2 July 2003 05:05:25 UTC