Lurker News
Cursed hacks, forcing proprietary software to do what you want through clever means, or just generally doing awful, beautiful things with technology?

Comments (499) 174 threads

Show all comments

Showing thread 29 of 174

caesil2 replies#
>that took about 10 minutes to generate

How?

Matheus281 reply#
I'm assuming:

    1. Generate a list of suburbs names separated by |
    2. Simplify the regex:
    2.1. Convert to a NFA
    2.2. Turn it into a DFA
    2.3. Merge redundant states
    2.4. Turn it back into a regex
KomoD1 reply#
nfa? dfa?
zdimension1 reply#
Nondeterministic finite automaton and deterministic finite automaton. The theory behind state machines.
KomoD#
Thank you
veeti1 reply#
Do they ever coin new suburb names? What happens then?
singingfish#
Yes they do. This was good for the early/mid 2000s - new suburbs are going to be a problem as australia post no longer give the list away for free.
wodenokoto2 replies#
How is that better than just checking against a list of suburb names?
_0ffh#
The regex is a compressed representation which saves memory, and it's also likely to be quite a bit faster which saves cycles. I consider it a clever bit of optimisation.
singingfish#
It's also handling what state the suburb is in, and can deal with various kinds of bad data (e.g. lack of uniformity of spacing and capitalisation).
phanimahesh1 reply#
How did you generate this?
singingfish#
perl module Regexp::Assemble