Live data from Hacker News

Regex Puzzle

bbc.co.uk

31–40 of 97 posts

Re: Regex Puzzle

#32
post #24
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…

How did you solve backreferences with that approach?

You don't. Back reference leave the space of mathematical regular expressions, that all this nice theory works for.

Re: Regex Puzzle

#33

Brilliant. My dad is 71, loves puzzles (like cryptic crosswords and Sudoku), is a huge technophobe, and has just retired. This should keep him busy until about 2022.

Technophobe or technophile?

Technophobe. Just acquiring the necessary Google skills to find out what the proper regex rules are will probably take him till Christmas. But hey, the man loves a challenge.

Re: Regex Puzzle

#34

Brilliant. My dad is 71, loves puzzles (like cryptic crosswords and Sudoku), is a huge technophobe, and has just retired. This should keep him busy until about 2022.

Technophobe or technophile?

Technophobe, probably. A technophile crossword aficionado should have this solved by dinner time.

Re: Regex Puzzle

#36

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.

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

Re: Regex Puzzle

#37

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.

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

Re: Regex Puzzle

#39

I know that there are problems to do with regex matching that are NP-hard. So I'm wondering if it is possible to attack this puzzle using an algorithm that simplifies the individual regexes using knowledge of the regexes that that they interact with?

This problem is NP-hard by reduction from SAT. Treat each column as a truth variable and use the rows to encode CNF clauses. For example, `(A | ^C)` becomes `(1..)|(..0)`. Then set all the column regexes to `( 0* )|( 1* )` to enforce a consistent truth value for each variable.

Could you elaborate on the encoding? What are valid mappings?

Re: Regex Puzzle

#40
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

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.
Post reply on HN