4 ms·
They seem to be accurate under all normal regex rules. Keep in mind that empty values are spaces and a full match is needed!
by ladberg 6y ago
They seem to be accurate under all normal regex rules. Keep in mind that empty values are spaces and a full match is needed!
- freeopinion 6y agoWhat does "full match" mean? Either it matches or it doesn't.
- ladberg 6y agoI think some people may have thought you just have to match any substring within it, so I was clarifying that the whole line has to be a match.
- freeopinion 6y agoSome people would be correct to think that. That is what those regexes mean. If you are secretly prepending a ^ and appending a $, then you are not using the regex displayed.
- danaliv 6y agoSorry, but you're wrong. There's nothing about regular expressions that means you have to use them to search for matching substrings. That's just one particular operation that uses regular expressions. It's not a quality inherent to regular expressions themselves. There are many different operations you can perform with a regular expression besides a substring search. Python, for example, has a fullmatch method.[0] libicu's matches() function returns true "if the pattern matches the entire string, from the start through to the last character."[1] PCRE has various flags that change what it means for a regular expression to match, including PCRE2_ANCHORED and PCRE2_ENDANCHORED. Used together, these options would require a full match with no change to the regular expression itself.[2] 0. https://docs.python.org/3/library/re.html https://docs.python.org/3/library/re.html 1. https://unicode-org.github.io/icu/userguide/strings/regexp.html https://unicode-org.github.io/icu/userguide/strings/regexp.h... 2. http://www.pcre.org/current/doc/html/pcre2api.html#SEC27 http://www.pcre.org/current/doc/html/pcre2api.html#SEC27
- schoen 6y agoAnother way to describe this could be that the meaning here is inherently ambiguous between "is-a" and "has-a", but the puzzle only makes sense (and only has a solution) if you interpret as "is-a". In Mystery Hunt puzzles, which this originally was, "we have to interpret this in a way that would allow there to be a meaningful and unique solution" is not only a perfectly legitimate form of reasoning, but often necessary! It's not really exactly the same kind of reasoning, but in a puzzle I wrote a year before this for the same event https://www.mit.edu/~puzzle/2012/puzzles/into_the_woodstock/sounds_good_to_me/ https://www.mit.edu/~puzzle/2012/puzzles/into_the_woodstock/... you could look at it and say "hiragana is only ever allowed to be used to write Japanese!!!" but insisting on that rule (much as it applies in most situations) wouldn't give the puzzle a meaningful solution. :-) Maybe a closer equivalent would be that in this year's Mystery Hunt, there was a puzzle using a set of variant Hashiwokakeru (Bridges) logic puzzles. There were hints about which rules were changed but it wasn't stated whether the rule changes applied individually (one puzzle each) or cumulatively (when rules get changed, they don't change back afterward), or some other way. So, it was necessary to make assumptions about what was meant and see whether they allowed a solution. That's typically considered fair and appropriate throughout Mystery Hunt-land.
- freeopinion 6y ago.(C|HH)* should match against " " or against "A " or against "B" or against "ZZZZZZZ". But this puzzle doesn't recognize any of those as valid.
- ladberg 6y agoThat's not the case... .(C|HH)* matches with single character followed by any number of C's or HH's. So " " or "B" would work but in the puzzle the full line has to match so those aren't possible
- freeopinion 6y agoCan you explain what you are seeing about "B" that does not match? Or about "_______"?
- ladberg 6y agoI agreed that "B" does match. However, the puzzle needs to match the full line and not just a substring so "ZZZZZZ" or "B " don't.
- freeopinion 6y agoYou have not explained how those are not matching the full line. I assert that they are. Show me actual correct code that says otherwise.
- chaorace 6y agoAs you can see[1], the regex checker is based on the JS RegExp.match method. Each cell is always 1 character long (so, either a letter of some kind or an empty space). The str parameter for the check function is assembled by concatenating these cells together[2], so the input string for an empty line will look something like this: "_______" Assuming an empty 7-cell row, the regex in question will match 7 times, once for each character. A result of multiple partial matches is not equivalent to getting just one perfect match, which is what the puzzle requires. Internally, the puzzle enforces this requirement by making each Regex rule require a full line match (see line 118: '^' + rule + '$'). Personally speaking, I felt like that was the most intuitive way to interpret the mechanics of the game, so I'm willing to give the programmer a pass when they slightly modify the regex rule prior to evaluation. [1]:https://github.com/Jimbly/regex-crossword/blob/8b178f32eba3799146fd5fdbe286e34d7cfe9e59/crossword.js#L116-L128 https://github.com/Jimbly/regex-crossword/blob/8b178f32eba37... [2]:https://i.imgur.com/PS0BmJ6.png https://i.imgur.com/PS0BmJ6.png