[thelist] Re: Formatting textarea

Katherine Spice k.spice at acu.ac.uk
Mon Feb 19 08:44:36 CST 2001


Hi Adrian,

\n = perl new line
\r = carriage return (which is what you are searching for :-), so

$form{'yourad'}=~ s/\r/<BR>/g;

will work, but you need to include the s operator, to treat the string
as single line, so what you want is

$form{'yourad'}=~ s/\r\r/<P>/gs;
$form{'yourad'}=~ s/\r/<BR>/gs;

HTH,

Katherine

Adrian Fischer wrote:
> Subject: Formatting textarea
> 
>  Hi Gang,
> 
>  I just dont get it!!!
> 
>  This little snippet of perl should take the contents of the the form field
>  named 'yourad', strip the double lines and replace them with <p> etc...but
>  it doesnt matter how I fiddle with it or where I put it nothing happens.
>  This is really starting to annoy me.  Can anyone offer a clue?
> 
>  $form{'yourad'}=~ s/\cM/ /g;
>  $form{'yourad'}=~ s/\n\n/<P>/g;
>  $form{'yourad'}=~ s/\n/<BR>/g;
> 
>  Thanks
> 
>  Adrian Fischer
>




More information about the thelist mailing list