I think I might be missing something. Wouldn't something like "a" be a valid 1-byte regular expression that only matches instances of "a"?
The regex ^a$ only matches "a", but it doesn't match itself.
21–30 of 66 posts
I think I might be missing something. Wouldn't something like "a" be a valid 1-byte regular expression that only matches instances of "a"?
The regex ^a$ only matches "a", but it doesn't match itself.
I wish I was as smart as these people.
I'm inclined to say that some people 'just get' certain things like this or complex SQL. How they got to 'getting it', I don't know.
Perhaps their talent is actually just an attraction to studying it really hard. I, for instance, do not have the patience to study regex so much as to ever get the point where I could easily answer this question.
I think I might be missing something. Wouldn't something like "a" be a valid 1-byte regular expression that only matches instances of "a"?
No. "a" produces a match when run on "a" and "bad" and "aaaa" and many more things. The regex ^a$ only matches "a", but it doesn't match itself.
I can still see the neat aspect of the post. But that is not a match.
Reminds me of a quine - a non-empty computer program which takes no input and produces a copy of its own source code as its only output https://en.m.wikipedia.org/wiki/Quine_(computing)
Reminds me of a quine - a non-empty computer program which takes no input and produces a copy of its own source code as its only output https://en.m.wikipedia.org/wiki/Quine_(computing)
I wish I was as smart as these people.
Earlier quoted context omitted.
I'm inclined to say that some people 'just get' certain things like this or complex SQL. How they got to 'getting it', I don't know.
And monads.
Earlier quoted context omitted.
No. "a" produces a match when run on "a" and "bad" and "aaaa" and many more things. The regex ^a$ only matches "a", but it doesn't match itself.
That isn't a match... I can still see the neat aspect of the post. But that is not a match.
Earlier quoted context omitted.
> NOTE, delimiters must be included Your regex is actually /a/ which does not match the string "/a/".
I would say that adding slashes is quite arbitrary constraint, and it is really language specific syntax that is limited to minority of languages (I believe it was introduced in Perl). If you do regexp in Java, Python, C you don't use slashes. Edit: looks like slashes weren't even used in the example.
> […] for the sake of the challenge, let the expression be delimited (starting symbol, expression, ending symbol ex: /fancypantpattern/ or @[^2048]@), if you want to argue quotes as your delimiter, so be it. I think given the apparent difficulty of this problem it won't make much of a difference.
Earlier quoted context omitted.
And monads.
My suspicion is that no one wants to explain monads because if they did it would be painfully obvious that they're a purgatorial way of getting around the basic mismatch between functional purity and actual computers.