XML Schema pattern problem with regular expressions

Discussion in 'XML' started by Jeff, Feb 25, 2005.

  1. Jeff

    Jeff Guest

    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?
    Jeff, Feb 25, 2005
    #1
    1. Advertising

  2. Jeff

    Joris Gillis Guest

    Tempore 17:30:10, die Friday 25 February 2005 AD, hinc in foro {comp.text.xml} scripsit Jeff <>:

    > 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-xmlschema-2-20041028/datatypes.html#regexs

    regards,
    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
    "Φιλήκοον ειναι μαλλον η φιλόλαλον" - Κλεόβουλος
    Joris Gillis, Feb 25, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,491
    Markus
    Nov 23, 2005
  2. Fred Smith
    Replies:
    1
    Views:
    921
    Martin Honnen
    Feb 5, 2004
  3. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,164
    Stanimir Stamenkov
    Apr 25, 2005
  4. Replies:
    3
    Views:
    2,783
  5. Noman Shapiro
    Replies:
    0
    Views:
    219
    Noman Shapiro
    Jul 17, 2013
Loading...

Share This Page