Re: [PHP] Propably easy regex question

2001-07-25 Thread Sheridan Saint-Michel

I would just do something like

if(substring($text, 0, 1) == )
{
  $text =  . $text;
}
else
{
  $text =   . $text;
}

Where $text is a line of text from your message.

Hope that helps
Sheridan

- Original Message -
From: Nicklas af Ekenstam [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 24, 2001 4:23 PM
Subject: [PHP] Propably easy regex question


 Hi

 Could anyone help me with a code snippet that would take a string and add
'
 ' to it at the start of every new line just as a mail client does when
 replying to a mail?
 I.e. I would like this:

 Hello,

 How are you?

 To look like this:

  Hello,
 
  How are you?

 When it's done.

 (Actually I would love it if it would also look for existing  at the
 beginning of a line, and if there are any, just add the  and not the
white
 space but perhaps thats too much to ask for ;-)

 Thanks!

 - Nille


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Propably easy regex question

2001-07-24 Thread Nicklas af Ekenstam

Hi

Could anyone help me with a code snippet that would take a string and add '
' to it at the start of every new line just as a mail client does when
replying to a mail?
I.e. I would like this:

Hello,

How are you?

To look like this:

 Hello,

 How are you?

When it's done.

(Actually I would love it if it would also look for existing  at the
beginning of a line, and if there are any, just add the  and not the white
space but perhaps thats too much to ask for ;-)

Thanks!

- Nille


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]