8 ms·
Regex Crossword
- quickthrower2 7y agoNow I've got 2 problems!
- brodouevencode 7y ago:iseewhatyoudidthere:
- pstoev 7y agoGood one. Reminds me of the Regex Golf: https://alf.nu/RegexGolf https://alf.nu/RegexGolf
- llacb47 7y agoPrevious discussion: https://news.ycombinator.com/item?id=6941231 https://news.ycombinator.com/item?id=6941231
- crispyambulance 7y agoI like it as a puzzle, but am concerned that it promotes "cleverness" in writing regexes. Don't do that people. Just. Don't. Keep regexes simple and stupid! Remember other people will have to read them someday.
- midgetjones 7y agoI remember this one the first time round! Previous discussion: https://news.ycombinator.com/item?id=8674039 https://news.ycombinator.com/item?id=8674039
- dang 7y agoThere was an earlier one too: https://news.ycombinator.com/item?id=6056011 https://news.ycombinator.com/item?id=6056011
- tigroferoce 7y agoI used it to learn regexp a long time ago and then for fun, because, regex are fun!
- deleted 7y ago[deleted]
- asicsp 7y agoas mentioned in about page [1], this site covers Javascript regex flavor surprised that this resource wasn't mentioned in a recent thread [2] about regex [1] https://regexcrossword.com/about https://regexcrossword.com/about [2] https://news.ycombinator.com/item?id=20614847 https://news.ycombinator.com/item?id=20614847
- carstenhag 7y agoI've made an open-source clone of this as an android app. It needs some onboarding and maybe a guide. Perhaps I have some time in 2-3 weeks to develop it further, does anybody have advice on what to include? https://play.google.com/store/apps/details?id=de.chagemann.regexcrossword https://play.google.com/store/apps/details?id=de.chagemann.r...
- opan 7y agoWill you put it on f-droid? I avoid the play store.
- carstenhag 7y agoI will have a look at f-droid! Not sure if it's easy to integrate. Right now I can publish the app to the play store via a gradle task.
- siempreb 7y ago> In order to remember which puzzles you have solved, we need to identify you in some way. No, that's a lie. No need for identification in order to save progress, you can use: cookie, browser storage, etc.. for that. Please be honest about why you are using social media for login. Because when I login with Facebook for example, you can see a large portion of my Facebook profile and depending on the plan you have way more than that.
- yoz-y 7y agoUsing cookies is brittle because they can get purged. They also don't sync. You could display some base64 encoded data to copy and paste between sessions but that would be quite unpleasant. One way would be to auto-generate accounts and display some random identifier to keep. Or maybe just offer e-mail to which they would send you a login link... There are other options but login with OAuth is not the worst.
- sli 7y agoSo use the browser's local storage feature and realize it's just a little toy and not so important that it needs bulletproof data retention.
- beefhash 7y ago> Please be honest about why you are using social media for login. Without speaking for Regex Crossword (I'm in no way affiliated with them): I suspect the reason may at least in part be security. Passwords are dangerous to keep around, hard to handle, computationally expensive if done right, and if an attacker gets at the database, people get angry. A social network provider (especially the options here, Facebook, Google, Twitter, GitHub and Windows Live) is much more likely to get security (against third party attackers) a lot more right.
- enedil 7y agoThat's just foolish - you don't need passwords of any kind. In fact you don't need accounts. You can just store cookies, accessible from this browser only, which tells you what have you solved.
- malisper 7y agoAh, this brings me back. I remember coming across these a few years ago and spending a ton of time solving them. I wound up taking a crack at writing a regex crossword solver. Suprisingly a solver that used basic constraint satisifcation[0] was enough to solve every problem I threw at it. The core idea was for each cell, keep track of a list of possible letters that can go there. Initially you start with the full alphabet, and as the solver repeatedly narrows down the list for each cell as it gets closer and closer to completion. To hone in on the solution, the solver would iterate through each regex and see what characters could go in that row or column to match the regex. For example if you have the regex "(a|b)" against an cell, you can constrain the list of possible values to the cell to just the letters "a" and "b". For a slightly more complex example, if you are matching a regex "(abc|def)", and you know the middle character has to be an "a" or a "b", you know the string in that row or column is "abc". By repeatedly checking each regex, the solver gets closer and closer to the solution until it eventually solves it. Of course there's a chance the solver will get stuck. As a last resort, you can always resort to backtracking. I wound up finding implementing backtracking wasn't necessary since the approach I mentioned above was enough to solve every puzzle I threw at the solver. [0] https://en.wikipedia.org/wiki/Constraint_satisfaction_problem https://en.wikipedia.org/wiki/Constraint_satisfaction_proble...
- cerved 7y agoNot very surprising when you consider that it's a constraint satisfaction problem
- lvh 7y agoI don't know if Lisp is to blame, but we had exactly the same thought, and I gave it a shot: https://github.com/lvh/regex-crossword https://github.com/lvh/regex-crossword I did the somewhat bruteforcy generate-strings-and-learn-from-that way, instead of working off the parse tree. The latter is clearly more efficient, but also not something I can implement in <1h before work -- and it has the logic engine in the center, meaning it's not a dead end if I want to pick it up again :-)
- seanhandley 7y agoPlease add " (2014)" to the end of the title.
- notkaiho 7y agoThis is both new to me and exactly up the street of someone I know, so really glad to have come across it!
- navane 7y agoI'm doing the tutorial and having never really understood regex, i just fill in 'A' everytime, and i pass all the tests. Not learning anything though.
- kdbg 7y agoNot sure how you're managing that, A is the answer to the first tutorial, but doesn't work for the second one. If you click Validate it'll shake and turn red, though you can skip ahead all you want, you want it to turn green and add a checkmark next to the title.
- navane 7y agoI wasn't entirely truthfull. Still, 4, 6, 7, 8 are all 'A' solutions. I went back over them and googled some words, now I do understand those. I guess all I showed was that if you don't want to learn, you're not gonna learn.
- lordgrenville 7y agoAgreed. I blazed through the tutorial without thinking much, and then when I started Beginner #1 I had to go back and look up most of it again.
- sli 7y agoYeah, some of the puzzles in Beginner seem to imply they need more than one character entered, but you can only enter a single character. `EP|IP|EF` matches those pairs literally, so I'm not sure what it wants me to enter if it only accepts one character. I'm no regex beginner but this overall presentation is pretty confusing.
- Jtsummers 7y agoThat example you gave is from the first Beginner puzzle, correct? There are two spaces to fill in. So one of those three sequences is the answer to that column (or row if you've rotated the puzzle). There's not an error. If you find the interface confusing, start with the tutorial levels which begin with a single character solution and progress to larger solutions. Each cell is clearly meant to be one character in a string, with the row/column being the entire string.
- harrygeez 7y agoThis is great but I think it would be more interesting the other way round: write regex to capture complex input. Maybe add some steps constraints to up the difficulty.
- wodenokoto 7y agoI love Regexcrossword. For anybody just learning regex, to to regexcrosswords as soon as you’ve completed your first tutorial! After that, keep regex101.com handy for testing and checking your regexes.
- lordgrenville 7y agoThis is a great, fun way to learn! Two points for improvement, in case the creators are reading: 1) It's not clear which flavour/implementation is needed. I was using https://regex101.com/ https://regex101.com/ to check until the puzzle where /+ is used, which that site claims is invalid in JS and PHP but OK in Python. 2) It would be great if filling a cell automatically moved you to an adjacent cell, as in most (regular) crossword apps.
- asicsp 7y agomentioned in about page [1] that Javascript regex flavor is used [1] https://regexcrossword.com/about https://regexcrossword.com/about
- lordgrenville 7y agoAh, I missed that. That really compounds the question though: I see that they explicitly recommend regex101, which claims that the clue is invalid JS regex
- asicsp 7y agoprobably they intended the user to choose JS on regex101 not sure about the question you hit a snag, can you post the details here? you might get your doubt cleared
- lordgrenville 7y agoOne of the clues on Beginner puzzle 4 is /+ Pasting that into regex101, with flavour Ecmascript, yields "Pattern Error" (rightly, since forward slashes enclose patterns, and thus need to be escaped).
- asicsp 7y agooh ok, got it and yeah, agree with you, this should either be escaped or some explanation added regarding delimiters
- brodouevencode 7y agoAaaaaaaaand there goes my morning
- lucaspottersky 7y agoshould make the input 1st focus and jump to the next in fewer seconds (or after double enter)
- bdarnell 7y agoI also like this larger hexagonal one: https://rampion.github.io/RegHex/ https://rampion.github.io/RegHex/
- ryanianian 7y agoMaybe it's just me but I find it immensely more difficult to solve the ones where the regex is rotated 90 degrees. Something about trying to write a thing left-to-right and mentally match it with a thing reading top-to-bottom is exercising a (clearly untouched) part of my mental pathways. I'd love for the top row to not be rotated it'd be much more fun.
- Fellshard 7y agoThe site does provide tooltips on the clues. But the text rendering is difficult to read, yes; smaller characters seem to nearly vanish.
- CodexArcanum 7y agoOn my browser at least there's a pair of arrows to rotate the grid so different equations will be "upright".
- lvh 7y agoI thought this was kinda neat so I taught a computer how to do it: https://github.com/lvh/regex-crossword/blob/master/src/lvh/regex_crossword/logic.clj https://github.com/lvh/regex-crossword/blob/master/src/lvh/r... Right now, it works using a logic programming engine (core.logic, essentially miniKanren), generating a bunch of strings that match the regex, and then applying them as constraints. If I were to improve it, I'd parse the regex, walk the parse tree, and assign constraints that way. (There's already a regex parser in there: that's how the string generation works.) That was my first thought, but that's more complex than what I want to tackle before work :) Right now there's a bug where if e.g. a regex AB|CD will get applied character-wise, so it might erroneously try AC or BD. The way to fix that is to make sure the answers actually match the regex all the way at the end. Using a constraint engine has the cool feature that it can show you multiple answers if they exist. (That's not true for my current implementation, because the string generation is randomized, so there's no guarantee it will visit each possible string.) Someone else has pointed out that there are a lot of clues in the titles, e.g. that the answers are palindromes. That would be easy to add: (map (fn [vars] (l/== vars (reverse vars))) (concat rows cols)) (Read: "for each row and col, create a constraint that the row/col must be equal to itself reversed".)
- CodexArcanum 7y agoA while back I wrote a little Rust library that does exactly what you say: parses a regex to use as a text generator. It was a lot of fun, and really gives you an appreciation for just how much bigger than ASCII matching the regex world can be! Writing a constraint-based solver that uses the generator library sounds like an amusing project as well! Link: https://github.com/CryptArchy/regex_generate https://github.com/CryptArchy/regex_generate
- tzury 7y agoNice! When done, go to http://alf.nu/RegexGolf http://alf.nu/RegexGolf to sharpen up your skill!
- myroon5 7y agoLots of Hitchhiker's Guide to the Galaxy references: https://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_the_Galaxy https://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_th...