W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2003

Re: Regular expression: How exclude the last \n character

From: Jeni Tennison <jeni@jenitennison.com>
Date: Mon, 24 Mar 2003 14:12:05 +0000
Message-ID: <1751389158764.20030324141205@jenitennison.com>
To: Cams Ismael <Ismael.Cams@siemens.com>
CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

Hi IsmaŽl,

> Every line must maximal be 50 characters long. But I want to avoid an CR is
> added to the last line. So I don't want
>
> bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
> </description>
>
> The regular expression I have now is:
>
>         ((.{0,50}\n){0,})(.{0,50})
>
> But with my editor it's still possible to enter without an error
> generation of my validator.

In the above expression, the last subgroup is allowed to be empty,
which means that it's possible for there to be no characters after the
last newline character in your element. Change it to:

  ((.{0,50}\n){0,})(.{1,50})

and your validator should complain; whether or not that changes what
you are able to enter with your editor depends on the editor.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Monday, 24 March 2003 09:12:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT