94

Technically,

(0|1)*

is the regular expression for everything.

Comments
  • 24
    Thanks! I'll remember this next time I need a regular expression for everything!
  • 3
    Too good to be true.. 😂
  • 20
  • 3
    @Froot That aint binary
  • 2
  • 2
    @abhi1401
    I think .* works because it all depends on how you use those extra characters.
  • 4
    @abhi1401 @coolq It ain't binary but it will match binary 😄
  • 2
    @Froot
    Yes, that's what I was pointing to 👍
  • 1
    @erikdreyer11
    Regex isn't that hard, there are some great tutorials online
  • 1
    @erikdreyer11 and you can find online regex testers that really come in useful when you try to debug a long one, showing you the groups, the alternates, and explaining the effect of each pattern on mouse hover
  • 4
    @erikdreyer11
    you have a problem
    you decide to use regexp
    you have 2 problems
  • 7
    @freeridet
    you have a problem
    you decide to use java
    you now have a ProblemFactory
  • 2
    @freeridet
    You have a problem.
    You decide to use regex.
    You have no problems.
  • 3
    It won't match infinite strings, like sqrt(2), so technically, not everything.
  • 3
    @beleg
    Here
    01110011 01110001 01110010 01110100 00101000 00110010 00101001
    "sqrt(2)" in binary. Who said normal strings and numbers can hold infinite lengths either?
  • 3
    But then quantum computing happened.
    Now your regex will fail and
    Your screen will show BSOD
    Your cpu might catch fire
    The worlds gonna stop spinning.
  • 0
    @Teknas that's an evil turndown you know 😂
  • 0
    @coolq right, more precisely, you can have the code of the Turing machine (or any coding) that describes (or prints out) any "computable" infinite string. But there are really some strings that cannot be computed. Check out Chaitin's Ω number for instance. (At least you need UTF for this one 😊)
  • 0
    @beleg
    Yep, absolutely!

    Pi is another string that cannot be computed without showing just the reference for it.
  • 1
    @ItsNotMyFault
    you have a problem
    you decide to use threads
    two you problems have now
  • 2
    @coolq unless you try to parse a non regular language.
  • 1
    @Wack
    Or that yeah :P
Add Comment