RE: [PHP] preg_replace() 'space' the final frontier
$statement=preg_replace(/ /,br,$original,19); Matthew Walker Ecommerce Project Manager Mountain Top Herbs -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 30, 2002 12:35 PM To: Php-General Subject: [PHP] preg_replace() 'space' the final frontier What I am trying to do is have a line of text break at a space after reading 19 words. Having read the various methods of finding and replacing one character with another, I settled on preg_replace as my best choice, but this function doesn't accept a space in the regular expression slot. What can I do to get around this, or is there a better function than the one I selected? $statement=preg_replace( ,br,$original,19); Warning: Empty regular expression in /home/www/host/document.php on line 71 --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002 -- 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]
RE: [PHP] preg_replace() 'space' the final frontier
Looking at what you wanted to do, I realized this isn't going to work. That line of code will put a BR between each of the first 19 words. Matthew Walker Ecommerce Project Manager Mountain Top Herbs -Original Message- From: Matthew Walker Sent: Wednesday, January 30, 2002 12:47 PM To: hugh danaher; Php-General Subject: RE: [PHP] preg_replace() 'space' the final frontier $statement=preg_replace(/ /,br,$original,19); Matthew Walker Ecommerce Project Manager Mountain Top Herbs -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 30, 2002 12:35 PM To: Php-General Subject: [PHP] preg_replace() 'space' the final frontier What I am trying to do is have a line of text break at a space after reading 19 words. Having read the various methods of finding and replacing one character with another, I settled on preg_replace as my best choice, but this function doesn't accept a space in the regular expression slot. What can I do to get around this, or is there a better function than the one I selected? $statement=preg_replace( ,br,$original,19); Warning: Empty regular expression in /home/www/host/document.php on line 71 --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002 -- 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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002 -- 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]
Re: [PHP] preg_replace() 'space' the final frontier
On Thursday 31 January 2002 04:00, Matthew Walker wrote: What I am trying to do is have a line of text break at a space after reading 19 words. Having read the various methods of finding and replacing one character with another, I settled on preg_replace as my best choice, but this function doesn't accept a space in the regular expression slot. What can I do to get around this, or is there a better function than the one I selected? $statement=preg_replace( ,br,$original,19); Warning: Empty regular expression in /home/www/host/document.php on line 71 Did you want to do this *every* 19 words or just the first 19 words? What you could do is 1) explode() the line of text into an array 2) array_shift() and print the first 19 elements 3) print line break 4) repeat from (2) if necessary -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Do not use the blue keys on this terminal. */ -- 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]