Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
rplnt
on Dec 20, 2013
|
parent
|
context
|
favorite
| on:
Regex Golf
Mine is a bit shorter, though a bit more "meh" as well.
^x{32}$|^(x{2}){1,8}$|^(x{64})+$|^x$
galen_tyrol
on Dec 20, 2013
[–]
improved, gives 80
^(x|(xx){1,9}|x{32}|(x{64})+)$
rplnt
on Dec 21, 2013
|
parent
[–]
I tried to get rid of those redundant ^ and $ but it somehow didn't work. I probably forgot to put it all inside one group.
alanh
on Dec 22, 2013
|
root
|
parent
[–]
They are not redundant. Any string of one or more exes is going to constrain a substring of exes of length 2^n (consider n=0 for a trivial proof), so you do need those anchors!
rplnt
on Dec 23, 2013
|
root
|
parent
[–]
I meant my previous post where I had them in every single possibility.
Consider applying for YC's Spring batch! Applications are open till Feb 11.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: