I am trying to use Regex in my Ruby program to convert “|” character into a line breaker, so for example:
# convert("title|subtitle") => "title \n subtitle"
The regex I’m trying is the following:
title_params =~ s/\|/\\n/
But I kept getting errors saying that “|” is not recognized.
Regex is not needed for this simple problem: