0

I am trying to understand the regex section of xmlschema here: https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs

Specifically, when is a "^" interpreted as a literal caret and when is it interpreted as 'everything after me is excluded'.

According to the w3 specification do you interpret this pattern:
[a-zA-Z^abc]
as:
a) any lower followed by any upper followed by a caret and then a, b or c or:
b) any lower followed by any upper followed by anything except a, b or c

TIA.

PS I am too new to be able to set tags for this question and to be honest I am not sure 100% for the tags for this question.
I would have liked to add xmlschema as a tag for this question but I cannot add new tags.
@any_moderator: feel free to update tags accordingly.

kenape
  • 1
  • 1
  • If you are still confused: `[a-zA-Z^abc]` in XSD Schema regex will match a 1-char string that is equal to any ASCII letter or `^`. – Wiktor Stribiżew Feb 13 '17 at 08:16
  • @WiktorStribiżew **all** regex flavors? At least firebird supports [character class subtraction by `^`](https://firebirdsql.org/refdocs/langrefupd25-similar-to.html) – Sebastian Proske Feb 13 '17 at 08:23
  • @SebastianProske: Actually, I meant the usage of a caret as a negated character class identifier and a literal caret symbol inside a character class. Anyway, the flavor in question is XSD Schema, and character class subtraction is defined with a [`-` and a nested bracket expression inside](http://www.regular-expressions.info/xml.html). – Wiktor Stribiżew Feb 13 '17 at 08:38
  • Many thanks for feedback to both! In this specific instance we are only interested for interpretations conforming to XSD schema so if within brackets the caret is not right after the opening bracket then it is interpreted as a literal caret. From what I can see I cannot award @WiktorStribiżew with correct answer I guess due to duplicate status. But if this isn't the case or any further action is required by me to close this question please advise me on how to proceed. – kenape Feb 13 '17 at 09:45
  • The [question linked at the top](http://stackoverflow.com/questions/16944357/carets-in-regular-expressions) contains the necessary explanations, so there is no point adding an answer here. – Wiktor Stribiżew Feb 13 '17 at 09:55

0 Answers0