Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - Re: xsd reg expression for not

 
Thread Tools Search this Thread
Old 06-30-2003, 05:22 PM   #1
Default Re: xsd reg expression for not


oops, mesage sent too soon,

so if you have a pattern that must not start with an A but can then have
many characters use

"[^A].+"

not "this" seems to be rarher clumsily

"[^t][^h][^i][^s].+"

perhaps there is a better way

Colin

"Colin Mackenzie" <> wrote in message
news:bdpnoj$heg$...
> the reg ex for not is the ^ (shift 6 on my PC) charcater
> "Red Ogden" <> wrote in message
> news: om...
> > Please can anyone tell me the regex for Not
> > E.g. I don't want the string to begin with 'this'??
> > Thanks in advance
> > Redge.

>
>





Colin Mackenzie
  Reply With Quote
Old 07-01-2003, 08:46 AM   #2
Red Ogden
 
Posts: n/a
Default Re: xsd reg expression for not

Many thanks again Colin - as you can no doubt gather I am new to reg
expressions - I see what you mean about being clumsy - is it necessary
to give a range for each letter? And would that mean that the string
could not start with 't'?

Thanks
Redge.

"Colin Mackenzie" <> wrote in message news:<bdpo4j$qtq$>...
> oops, mesage sent too soon,
>
> so if you have a pattern that must not start with an A but can then have
> many characters use
>
> "[^A].+"
>
> not "this" seems to be rarher clumsily
>
> "[^t][^h][^i][^s].+"
>
> perhaps there is a better way
>
> Colin
>
> "Colin Mackenzie" <> wrote in message
> news:bdpnoj$heg$...
> > the reg ex for not is the ^ (shift 6 on my PC) charcater
> > "Red Ogden" <> wrote in message
> > news: om...
> > > Please can anyone tell me the regex for Not
> > > E.g. I don't want the string to begin with 'this'??
> > > Thanks in advance
> > > Redge.

> >
> >

  Reply With Quote
Old 07-01-2003, 04:15 PM   #3
Colin Mackenzie
 
Posts: n/a
Default Re: xsd reg expression for not

yes, it was clumsy and you are correct in saying that it would not alow
"that" (because of the not "t").

I was stuck so I put a question into the schema dev newsgroup.

The basic answer is that whole strings cannot be negated in the current
version of schema.

Jeni Tennision however did come-up with the following work around however
(Jenni's comments below). I simplified the string to negate to be "STR".
I think you can use:

(([^S].*)|(S[^T].*)|(ST[^R].*))

in other words, the string can start with something that isn't S; or

it can start with S, as long as it's followed by something that isn't

T; or it can start with ST, as long as it's followed by something that

isn't R.

Cheers,

Jeni

---

Jeni Tennison

http://www.jenitennison.com/



"Red Ogden" <> wrote in message
news: om...
> Many thanks again Colin - as you can no doubt gather I am new to reg
> expressions - I see what you mean about being clumsy - is it necessary
> to give a range for each letter? And would that mean that the string
> could not start with 't'?
>
> Thanks
> Redge.
>
> "Colin Mackenzie" <> wrote in message

news:<bdpo4j$qtq$>...
> > oops, mesage sent too soon,
> >
> > so if you have a pattern that must not start with an A but can then have
> > many characters use
> >
> > "[^A].+"
> >
> > not "this" seems to be rarher clumsily
> >
> > "[^t][^h][^i][^s].+"
> >
> > perhaps there is a better way
> >
> > Colin
> >
> > "Colin Mackenzie" <> wrote in message
> > news:bdpnoj$heg$...
> > > the reg ex for not is the ^ (shift 6 on my PC) charcater
> > > "Red Ogden" <> wrote in message
> > > news: om...
> > > > Please can anyone tell me the regex for Not
> > > > E.g. I don't want the string to begin with 'this'??
> > > > Thanks in advance
> > > > Redge.
> > >
> > >



  Reply With Quote
Old 07-02-2003, 11:01 AM   #4
Red Ogden
 
Posts: n/a
Default Re: xsd reg expression for not

Colin
Many thanks for the further explanation and for Jenni's workaround.
All the best
Redge.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump