Hacker News new | ask | show | jobs
by wodenokoto 1340 days ago
what are the / for?

I couldn't figure out how to get started until I read someone in the comments suggest to make them optional.

1 comments

It's a traditional Regex syntax in several languages including JS (relevant here), Perl, and going way back to ancient Unix tools such as vi and ed.

The vi/ed form you often see in HN and other technical discussion memes too, such as:

s/easy/hard

Which is a joke to substitute uses of the word "easy" with "hard". The slashes mark a RegEx so you can get really clever in such jokes, though usually most such jokes are simple word substitutions.