![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Schema pattern's and dashes. [Thread Next] Re: Schema pattern's and dashes.To: NULL Date: 11/4/2006 7:51:00 PM
<requeth@g...> wrote in message
news:1162579227.261072.66150@f......
> Hello,
>
> I'm using a schema with pattern validation for field edits. Everything
> is working well except when it attempts to validate dashes. I'm using
> - as the code for the dash -, but it keeps rejecting the character
> in field. Here is an example of my pattern that I am running:
>
> <xs:pattern value="[0-9, a-z, A-Z, &,', ,, -, (,
> ), ., # ",  ]{1,60}"></xs:pattern>
>
> Everything else works 100% by design except the dash. Any ideas?
>
> Thanks,
>
> T Starid
>
Try this:-
<xs:pattern value="[0-9a-zA-Z, &\-().#"]{1,60}">
There is no need to separate elements in character group with comma space.
All that was doing was including comma and space in the list of characters
to match. There is also no need to use XML escape for most of the
characters.
The problem with dash - is it is one of the few characters that has a
meaning in the inside a character group so needs to be escaped with \ even
if the dash is encoded using the XML escape since all xml escapes will be
transformed to the appropriate character before the expression is parsed.
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
