Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML Schema pattern problem with regular expressions

Reply
Thread Tools

XML Schema pattern problem with regular expressions

 
 
Jeff
Guest
Posts: n/a
 
      02-25-2005
For the life of me, I can't create a working regular expression for a
schema pattern to do the following:

Validates if an entire word does NOT match the entire word in the
pattern.

For example, in the pattern the word my be "foo". If the word "foo" is
in my XML it should fail. If any other word, such as "cat" or "foot" or
"barfoo" is in the XML, it should pass.

The closest I've come for the regular expression in the pattern is
"(?i)^(?!foo)[A-Za-z]*"

The only problem is it invalidates anything starting with "foo" that
contains other characters such as "foobar". "Foobar" should pass while
the ONLY string that shouldn't is "foo".

Anyone know how I can do this in the W3 Schema regular expression
pattern?

 
Reply With Quote
 
 
 
 
Joris Gillis
Guest
Posts: n/a
 
      02-25-2005
Tempore 17:30:10, die Friday 25 February 2005 AD, hinc in foro {comp.text.xml} scripsit Jeff <(E-Mail Removed)>:

> Validates if an entire word does NOT match the entire word in the
> pattern.
>

In Perl regex, you would do "^foo$" to match only "foo" and nothing else. The "^foo$" still needs a negation, because it does exactly the opposite of your requirement.

I think their should be a likewise functionality in W3 Schema regular expression.
http://www.w3.org/TR/2004/REC-xmlsch...es.html#regexs

regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
"Φιλήκοον ειναι μαλλον η φιλόλαλον" - Κλεόβουλος
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web.xml / XML schema issue, why do some XML schema attributes disappear asciz@starmail.com Java 3 02-20-2007 09:56 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
multiple pattern replacement using regular expressions Jarkko Viinamki Java 1 02-22-2004 06:22 AM
XML schema regular expressions question and recommended XML Schema book Fred Smith XML 1 02-05-2004 11:12 AM
Add custom regular expressions to the validation list of available expressions Jay Douglas ASP .Net 0 08-15-2003 10:19 PM



Advertisments