473,320 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

XML Schema pattern problem with regular expressions

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?

Jul 20 '05 #1
1 1675
Tempore 17:30:10, die Friday 25 February 2005 AD, hinc in foro {comp.text.xml} scripsit Jeff <jb*****@gmail.com>:
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)
"Φιλήκοον ειναι μαλλον η φιλόλαλον" - Κλεόβουλος
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: kk | last post by:
I have this portion in my schema definition: <xsd:simpleType name="MyTimeType"> <xsd:restriction base="xsd:dateTime"> <xsd:pattern value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}-Z"/>...
1
by: Fred Smith | last post by:
Any suggestions or tips to the questions below I have been wrestling with would be most welcome: I have an example XSD file I have been experimenting with. Suppose a user can select from 1 to 4...
6
by: Phil Jarvis | last post by:
I have an XML Schema with regular expressions. e.g. <xsd:pattern value="{1}*"/> I have other patterns in the same schema document which share regular expression substructure, like the string...
8
by: UndoMiel | last post by:
Hi, I am looking for a way to validate IP addresses using XML Schemas. The following is what i used: <xsd:simpleType name="IPType"> <xsd:restriction base="xsd:string"> <xsd:pattern...
5
by: Drew | last post by:
We have a string like: 2004\05\05T00:00:00 We would like to remove all "\", any "-" and the T00:00:00 part of the string. The end result would be 20040505. I know that if I use as the...
5
by: Terry Olsen | last post by:
Is there a good way to find a pattern of bytes/chars in a stream? I've got a serial port connected to a tcp port. I need to be able to catch a unique character string in the stream so that I can...
4
by: Jéjé | last post by:
Hi, I have a file which contain 1 pair of values by line like: Name1=Value1 = I nned to store these pair of values in a sortedlist. So the result expected for the 2 samples lines is: Key ...
5
by: olaufr | last post by:
Hi, I'd need to perform simple pattern matching within a string using a list of possible patterns. For example, I want to know if the substring starting at position n matches any of the string I...
4
by: syed.akhlaq | last post by:
Hi, Does anyone know how can I validate XPath expressions using xsd schema? Thanks
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.