Hacker News new | past | comments | ask | show | jobs | submit login
How to Match “A B C” where A+B=C: The Beast Tamed (2018) (drregex.com)
95 points by tosh on Dec 8, 2019 | hide | past | favorite | 11 comments



Wonder what happened to the regex101 demo link [1], it just redirects to home page

[1] https://regex101.com/r/8e2iU1/2

---

Edit: Found a newer article [2] which does point a working regex101 link [3]

[2] http://www.drregex.com/2018/11/how-to-match-b-c-where-abc-be...

[3] https://regex101.com/r/QsFZ5M/2


The link works for me.


Real example of how comodity enterprise software is configured.


"# Carrying. This is where it gets complicated"

Oh, I thought we were past that already...


This is a crime against sanity


This could be the best and the worst thing I've seen all year.


What a fascinatingly bizarre little program. It's like some kind of immutable-data assembly language with tortured syntax. The next level of Brainfuck.


a b c where a+b=c is not a regular language. What exactly is the constraint on this challenge?


Whatever the PCRE supports. This essentially means that you can have at least a context-sensitive grammar, which I think a+b=c indeed is.


Should probably read the articles first... I was really hoping for:

    a + b = c, where a = b = c
I could only find:

* a = b = c = 0

* a = b = c = k/inf (where k < inf and k > -inf)

Off-topic but are there other solutions? I checked in Wolfram Alpha and nothing...


Not sure where you get those weird infinity results from, but the "a = b = c = 0" solution is easily show:

Note that "a + b = c" implies "b = c - a", and given our assumption that "a = b = c", we can rewrite as "a = a - a = 0". This obviously results in "a = b = c = 0".

EDIT: Modifying the proof above, it becomes apparent that this is a property of groups (most number systems are groups): Again "a + b = c", iff "a + a = a" iff "a + a + (-a) = a + (-a)" which is "a = e".

Note that addition over IEEE754 floats do not constitute a group, (in part) because "inf + inf == inf" evaluates to true.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: