Re: preg_replace on digit word boundry in 2 lines how about 1?

From: Date: Mon, 18 Mar 2002 19:08:32 +0000
Subject: Re: preg_replace on digit word boundry in 2 lines how about 1?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-88986@lists.php.net to get a copy of this message
i can do this if i do it in two line..i'm wondering if it can be done in 1 line. the two lines: $replace = preg_replace("/(\d)(\D)/","\\1,\\2",$digiword); $replace = preg_replace("/(\D)(\d)/","\\1,\\2",$replace); tia, joe Joe Rice(riceja@particle6.com)@Mon, Mar 18, 2002 at 12:39:17PM -0600: > > hi, > i'm trying to replace ever digit nondigit boundary with a "," > in a string. i'm trying to get \d\D to be replaced with \d,\D > and the reverse \D\d with \D,\d ... i'm not having any luck. > > $digiword = "123joe123" > $replace = preg_replace("/(\d)(\D)/","\\1,\\2",$digiword); > > this ends up with $replace being 123,joe456 > > how can i also catch the joe456 to end up with > > 123,joe,456 > > > any help would appreciated. > > thanks, > joe > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- How do i get rid of those words in my screen that are coming from you?

« previous php.general (#88986) next »