Hacker News new | past | comments | ask | show | jobs | submit login
Skype's Crazy Regex Easter Egg (nyaruka.com)
216 points by nicpottier on Feb 14, 2011 | hide | past | favorite | 51 comments



I find it highly annoying that this, as far as I understand, really doesn't use regular expressions.

The s/that/this/ syntax is not, of course, a regular expression. The regular expression is the thing that might go into the "that" part, an expression that can match against several different inputs. If all it supports is literals, it's not really worth calling it a regular expression, in my opinion.

The article expresses this like so:

Some experimentation shows that it isn't a full regular expression engine, it will only do straight word substitution.

I think this is stretching it; sure all literal strings are regular expressions, but if that's all there is (i.e. no alteration, repeat etc), then why call it an RE at all?

Am I just being grumpy?


Oh, no argument there, though being "highly annoyed" may point to some grumpiness.

It is clearly not a regex engine, but it operates like a very very naive one, and uses the Perl syntax for them.

Ultimately Regex just seemed like the easiest / clearest way of describing the functionality. IE, if I say "Skype supports the Perl Regex syntax for simple word substitution" you probably instantly think of s/a/b/.

Maybe I should have used that as the headline, but it seemed a bit long.


Historicaly it is more a sed like syntax..


And 'sed' is even easier to say than 'perl regex'!


I probably would have said "It supports sed-like substitution" (or maybe even s/sed-like/vim-like/). Generally speaking, regular expressions denotes finding something while this does more than that. Regardless, this level of pedantry shouldn't come as a surprise on HN (I admit to being guilty of it myself).


I agree. Annoyed me also. There's nothing regexp about it at all. And then TFA says that this is 'Perl syntax'.

Sure, Perl uses that syntax but it was inherited from sed which got it from ed.


Man, everybody is grumpy today, happy valentines? :)

I know Perl. It is the Perl syntax for regular expressions. I never said it was the first or only to use that syntax. Sheesh.


OK. I'll cheer up. Here's my Valentine's Day appropriate story.

http://blog.jgc.org/2011/02/hacking-toshiba-t4800ct-love-sto...


I think that's a bit grumpy. It's fair to call this "regex," not because it's exactly a regular expression matcher, but because it clearly borrows its syntax from a popular regular expression engine (one that's traditionally used for simple word replace in chat windows). Similarly, most people use the term "regex" to refer to the full engines in most programming languages, which are often much more powerful than actual regular expression matchers (e.g. back references).


I agree with you. This is simple substitution. (If we're going to call this a regex mechanism, so is Find/Replace in Word.)


I don't mind downvotes, but what are they for? (I upvoted the parent post out of the negatives and now I'm there... I guess that's karma huh.)


Sometimes they come from fat fingering the downvote button on a cellphone. Such downvotes are usually rectified eventually.


I was sceptical about this, but it works.

I also noticed recently that, in a somewhat shell-like way, you can press the up arrow to edit your previous message at will (but perhaps this is common knowledge).


yup, just some toying around by our mac devs :)


As a suggestion, you could search the line for the substring with the least Levenshtein distance from the correction, to use as the text to replace—and thus also support the "*word" correction syntax I see quite more often from non-technical friends. :)


I believe (though am likely wrong) that the *correction format originated in IRC, where you can't edit text once you've sent it... though I now see s/wrd/word/ quite often too - but that's mainly in technical rooms.


And apparently your Windows devs as well...


Valentines day special

guy> I love you darling!

girl> GO 2 HELL!!

guy> s/love/hate

guy> s/darling/bitch


Last time I tried, I could only edit my posts while the other one hadn't answered yet. So: haha, but no.


You can right click any message in your history and hit edit.


Not on Windows...


In a group chat, I seem to be able to edit my previous messages OK - even if someone has replied already and if I've written something else since then.


You can type in "/help" in a chat to see more options:

    sys: Available commands:
     /me [text]
     /add [skypename+]
     /alertson [text]
     /alertsoff
     /whois [skypename]
     /help
    For more help please see http://www.skype.com/go/help.chathelp
Clickable link to the full list: http://www.skype.com/go/help.chathelp


So how do I write the literal version now? I still want it for humorous effect.


Just leave off the trailing slash. Once someone pointed out that the sed syntax works for replacing, I started doing that.


So how does it look in your logs?

I will pay you $1,000 to do this project for me

(at end of chat)

s/$1,000/$1


When I first found this feature, I tried to write an email to Skype to thank them for including it. Sadly, there is no way to do such a thing. I looked all over their website for a contact email address, and I finally found one on a hard-to-find page, but when I wrote my message to it, I just got an auto-reply saying basically “please don’t send email to us. Call us or open a support ticket.” Opening a support ticket just to say “thank you” didn’t seem right. It’s sad that the company provides a way for people to complain about the program not working, but not for people to thank the makers of the program. (And I don’t think it’s because thank yous are useless to the company – knowing what your customers like is valuable feedback.)


That feature has been around since 2008, iirc.


This has worked for as long as I can remember.


How is this an easter egg? Been using it for years.


It’s an easter egg in that there is no documentation for the feature, and it is one that only people who are “in on the joke” (use IRC) would look for. The feature being functional doesn’t prevent it from being an easter egg.


Doesn't work in the linux version :( Skype, can we have an update with new functionality? (the interface is fine!)



Mmh, I noticed it works with my Skype client, on Fedora, while it doesn't work wth my buddy's client, on Windows.


Works on Windows. At least it did a few months ago when I first discovered it.


I've always wanted to implement this in my IRC client, but been too lazy, it's nice to see it implemented in some form of chat client, although it's a bit lacking. Is the change visible for all participants?


You can edit sent messages on IRC?


No, but some clients such as linkinus will apply the regex on the client-side. Less capable clients just display it like any other message.


Nope, but this would be a purely client-only visual thing (so, editing the local chat buffer), primarily just to have done it.


The main theme for a Mac based IRC client has this feature built in. Though it only reflects for people that have that client/theme. If you are wondering the client, it is Linkinus.

I believe the change is visible in Skype for all participants.


You do not need to type in /s/blah/anotherblah, it is already enough that you just hit the 'Up'-key on your keyboard. You then can edit previously written text!!!

It is really interesting that nobody points this out ;)


You can also right click on a reply and click "edit message" [1] – tested on Skype for OS X.

[1]: http://cl.ly/4Z1R


You can also press the upper arrow to edit the last message (on mac)


This doesn't work on windows version of skype.. i guess windows users have to pay for not having regex :P


Now a good question would be, will it work if I had Regex for windows installed when installing skype or what is its windows replacement..!!


Cool so whats the regex to erase all the previous comments?


s/Bit/But


Thanks. :)


/topic works as well.


words* <- I just saved a few bytes worth of network traffic, and a whole lot of CPU cycles.


At the cost of mental cycles of your recipient reader to parse what just happened, which come in much less available quantity than network bytes or CPU cycles.




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

Search: