Re: How would i convert this regex using TT replace?

[email protected] (Randal L. Schwartz) Wed, 08 Aug 2012 05:58:24 -0700
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <[email protected]>
>>>>> "Summer" == Summer  <crazysummer2004-/[email protected]> writes:

Summer> Hello,
Summer> I have this in javascript, but having issue converting it to be able to use with template toolkit replace method.

Summer> js way:
Summer> replace(/(\r\n|\n|\r)/gm,"<br />");

Summer> template toolkit way?

Use the built-in FILTER html_line_break:

[% some_value FILTER html_line_break %]

perldoc Template::Manual::Filters for details

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion