Live data from Hacker News

Regex Puzzle

bbc.co.uk

71–80 of 97 posts

Re: Regex Puzzle

#71
post #40

Earlier quoted context omitted.

I think parent said why: there's no RegexBuddy on Linux. I can see you're new, so I won't be harsh but HN isn't the place for this kind of commentary. Everyone here understands the difference between Windows and Linux. Judging and/or trolling over Windows is boring, take it over to Reddit or something.

Yes, thank you. I of course use Linux, but I really don't care to remember the specifics of regex libraries across PHP, Python, JS or Java. So I just work out my regex, and from the drop downs choose "Use->Javascript->Chrome->Get Text From Numbered Group". And it spits out like 6 lines of JS that will handle cases of it either being found or not. You can choose the names of the ingoing and outgoing variables. You don…

The funny part (to me) is that it was already obvious you use Linux or mac -- some flavor of (star)nix -- because you said you keep a Windows install at the ready. That implies to me that Windows isn't your primary OS. I keep a Windows install at the ready too, for a whole bunch of reasons that have nothing to do with how much I like or dislike Windows.

I would love to be able to remember regex specifics from lib to lib and app to app, but try as I might, I can't. I never know if I have lookaheads or backrefs or named captures available and what the syntax is, I can't remember if there are named character classes. I end up reading the docs, again, almost every time I dig into a regex problem. Same reason for me- I use too many flavors of regex libs. If I could stick to one language, I'd have some hope.

I haven't tried RegexBuddy, but now I'm going to because of your comment, thanks for sharing!

Re: Regex Puzzle

#72
post #55

Nice! At Keplers in Mountain View you can buy version of Scrabble that uses regexes. The designer used to sell it in front of the shop -- he is obviously a programmer.

Can you please expand a bit on how it worked?

Re: Regex Puzzle

#73

Regex is one of those tools that I use a couple times a year - usually for cleaning up lousy input data. I always end up spending a fair amount of time using tools like: http://regex.inginf.units.it/ https://regex101.com/ http://www.regexr.com/ And of course stackoverflow.

Really? I use it fairly often, usually for cleaning input data and similar. But I only use a subset of regex functionalities that works across different engines and that doesn't make problems with escaping strings (no backslashes and similar).

Re: Regex Puzzle

#76

This BBC report refers to a puzzle released by the UK's National Cyber Security Centre [1], as part of an online recruitment effort. [1] https://www.ncsc.gov.uk/news/take-our-regex-crossword-challe...

Interstingly, Bletchly Park is known to have used crossword puzzles published in The Daily Telegraph as a recruitment tool for "codebreakers" during WWII.

https://en.wikipedia.org/wiki/Bletchley_Park#Personnel

Re: Regex Puzzle

#77

Earlier quoted context omitted.

Which positions? I didn't find any that were under-constrained.

Assuming 0 indexing: row 0 column 4. Constrained by rows 0, 2, 3 where rows 0 and 2 have [^XZVCHFJLQM] and [^\sPQFB] and row 3 has [OYSRU]. All of: O, Y, S, R and U match. Am I missing something?

You did the same thing I did I imagine. The regexcrossword.com link has a small mistake:

[^PZVJG]{4}(.)[EFUG]{6}(.)[^\sPZVJI]{2}

should be

[^PZVJG]{4}(.)[EFUG]{6}\1[^\sPZVJI]{2}

(note the \1 )

Re: Regex Puzzle

#78
post #36

Earlier quoted context omitted.

I will always keep a Windows install at the ready just for RegexBuddy. I use it mostly to take a regex and generate the code I need for it (e.g. find the first numbered group in match in javascript), without having to remember language specific details.

Why don't you just learn learn Linux and pcre? What use are 2-bit windows tools? Don't fill your head with windows - a dead os walking

Perl compatible regular expressions are not regular expressions at all. (https://en.wikipedia.org/wiki/Regular_expression#Formal_defi...)

Re: Regex Puzzle

#79
post #22

I've worked on the project where some XSD files defined fields with regex restrictions, also some rules over fields added other stricter regexps or negative regexps depending on some context in a format called Schematron. I had to generate XML files conforming to those XSD, so I used some tools around Z3 solver and Microsoft.Automata to generate those strings conforming to multiple regexps. It would convert the regex…

There's also redgrep (https://github.com/google/redgrep) that supports intersection and complements of regular expressions.

I am toying the idea of writing a little game where player A thinks of a regular expression, and player B tries to guess. If B guesses right, they win. If B guesses wrong, A has to provide a false positive and a false negative (if they exist), and B gets to guess again.

Can you think of ways to automate the roles of A and/or B?

Re: Regex Puzzle

#80
post #55

Nice! At Keplers in Mountain View you can buy version of Scrabble that uses regexes. The designer used to sell it in front of the shop -- he is obviously a programmer.

Can you please expand a bit on how it worked?

Never played it, but from looking at the box of talking to the inventor it was just that The set of letters included regex operators and those The set of letters included regex operators and those you could put on the board as well. Meaning other people could use him as well To make words.
Post reply on HN