Hacker News new | past | comments | ask | show | jobs | submit login

what's the pattern on "Abba"? I thought it was just to exclude doubled letters but I have doubles on two words on the left hand side as well (noisefully and effusive, in case the word lists are the same)



Excluding doubled consonants that have the same vowel on both sides of the pair:

  ^((?!([aeiou])([^aeiou])\3\2).)*$
The following also works for the testcases and is shorter:

  ^((?!(.)(.)\3\2).)*$


Can get 2 more points with:

  ef|^((?!(.)\2).)*$
But I reckon yours wins for having a pair of breasts in the middle


well, if you are strictly interested in matching with the fewest characters, regardless of the apparent pattern:

  ^(.)(.).*\2\1$


Your anchors at the end make it match nothing.


sorry, misreplied. This was for palindromes.


5. Abba (^unv|.u|z|ph|mi|st|vi|tan)

haha




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

Search: