Question

I couldn't find any documentation on this symbol. What does "-?" mean when it precedes a parenthetical expression?

Update - The example I saw is the integer and float regex constraints on the WebIDL specification. Here is a direct link to the grammar appendix: http://dev.w3.org/2006/webapi/WebIDL/#idl-grammar

Was it helpful?

Solution

It's pretty standard for «-?» to mean "match the character «-» zero or one times".

$ perl -E'
   say "$_: ", /^aaa-?bbb\z/ ? "match" : "no match"
      for qw( aaabbb aaa-bbb aaa--bbb );
'
aaabbb: match
aaa-bbb: match
aaa--bbb: no match

I'd be extremely surprised if it didn't work the same way in C#.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top