Regex Char Class Subtraction spec available [Kit George]

Regex Char Class Subtraction spec available [Kit George]

  • Comments 6

I propped the character class subtraction specification up on the BCL website:

http://www.gotdotnet.com/team/clr/bcl/TechArticles/techarticles/Specs/Regex/CharacterClassSubtraction.doc

This feature will be one of the many enhancements we make to Whidbey, so keep an eye out for it in Beta1.

Any feedback on the specification is appreciated!

  • Maybe my in-brain regex parser is buggy, but I think this line was incorrect?

    [-e-f] Valid, not a subtraction. Although this is a valid expression, it is not a subtraction. Instead, this is an expression looking for the minus sign, or any letter a through e.

    I see that as a minus sign, or any letter e through f (so just minus, e, and f).

    Did I miss something?
  • Would you consider adding a flag to enable/disable this new behaviour it might be easier to port
  • Matt, thanks for that, and I agree: a pretty clear copy/paste error! I'll get that updated
  • Dmitriy, we didn't consider this, mostly becuase the cases where there may be conflict with existing expressions are obscure enough that we don't believe we'll break any existing code.

    What are you porting to?
  • I saw another minor (but confusing) error toward the bottom of page 3. Under "Impact on Current Behavior", you have a paragraph that starts "Today, this will be interpreted as ‘any a through e character, minus sign, open square bracket, b, d, or close square bracket, immediately followed by a close square bracket’." I think you need to take out the "or close square bracket" -- i.e., the character class will *not* match a right square bracket; the first ] ends the character class, the second ] is matched as a literal, and neither is part of the character class today.

    It might also be nice if you would include a brief mention of how you can make a character class that *does* include a square bracket, and whether that syntax is affected by the new feature. Do you escape it with a backslash?
  • Joe, nice pick: I just updated the file (check for the update in around a day). I fixed the first part, and I like the second suggestion, I simply have to explore getting that kind of feedback incproporated into the docs, instead of simply this file here, so I'm going to be looking at that option.

    Thanks for the deeback!
    Kit
Page 1 of 1 (6 items)