thanks for the quick response, I can't get newlines in the output program: #lang racket (display "inpu#\nt-str#\ning#\n\n") (printf"~a~a~n""printf""inpu#\nt-str#\ning\n") (printf"~a~a~n""printf""inpu\nt-str\ning\n") (regexp-replace* "\n" "inpu#\nt-str#\ning#\n " "\n<br>") (regexp-replace* "\n" "inpu#\nt-str#\ning#\n " "\\n<br>") (regexp-replace* "\n" "inpu#\nt-str#\ning#\n " "#\n<br>") (regexp-replace* "#\n" "inpu#\nt-str#\ning#\n " "#\n<br>") (regexp-replace* "#\n" "inpu#\nt-str#\ning#\n " "#\\n<br>") (regexp-replace* "#\n" "inpu#\nt-str#\ning#\n " "#\\\n<br>")
____________ output: Welcome to DrRacket, version 5.3.4 [3m]. Language: racket; memory limit: 10000 MB. inpu# t-str# ing# printfinpu# t-str# ing printfinpu t-str ing "inpu#\n<br>t-str#\n<br>ing#\n<br> " "inpu#\nn<br>t-str#\nn<br>ing#\nn<br> " "inpu##\n<br>t-str##\n<br>ing##\n<br> " "inpu#\n<br>t-str#\n<br>ing#\n<br> " "inpu##\nn<br>t-str##\nn<br>ing##\nn<br> " "inpu##\n\n<br>t-str##\n\n<br>ing##\n\n<br> " > (just throwing random numbers of # and \\ in to see what I'm misunderstanding) On Fri, Jun 07, 2013 at 09:24:07AM -0400, Sean Kanaley wrote: > (regexp-replace* "\n" input-string "\n<br>") > > would be the target expansion for those pairs. > > On 06/07/2013 08:57 AM, Sanjeev K Sharma wrote: > >I have to clean up a bunch of source files that don't show properly > > > >I have a file from which I'm reading a bunch of regular expressions to > >replace, things like this: > > > >(#px"(?i:%5C)""/") > > > >but included in the same file (full of from-to pairs) are a bunch of > >straight string replacements, like this: > > > >("…""\\…") > > > > > >I cannot figure out what's wrong with this one: what to do here > > > >("\n""\n<br>") > > > >it replaces the starting "\n" but never puts in the replacement "\n" > > > >I've doubled/tripled/quadrupled on the backslashes > > > >("\n""\\n<br>") > >("\n""\\\n<br>") > > > >but that doesn't put in a newline, rather two separate characters, > >"backslash" and "n" > > > >any hints what I'm doing wrong here? > >____________________ > > Racket Users list: > > http://lists.racket-lang.org/users > ____________________ Racket Users list: http://lists.racket-lang.org/users