Is there a placeholder for the full capture in regex search?


#1

I’ve tried search and replace using \n$0 in the replacement pattern to prepend newlines before the fully matched expression. This did not work however, instead Atom replaced the matches with the literal $0 characters. I’ve also tried the placeholders \0 and & without success. Is there a placeholder for the full search match?

In the meantime, I just put braces around the search term and use \n$1 instead, but it’s annoying.


#2

Atom uses JavaScript regular expressions for search and replace. According to MDN, $& is the replacement string for the entire match: