In message <[EMAIL PROTECTED]> , Mladen Milankovic <[EMAIL PROTECTED]> writes >On 4/15/08, Pete Clark <[EMAIL PROTECTED]> wrote: >> I have got as far as >> preg_replace('/\.\S/i', ". $0", 'Hello world.Hello world'); >> which gives me >> "Hello world. .Hello world" >> >> Can anyone figure out the correct code. > >Hi. >Try out this one: > >preg_replace('/\.([^\s])/i', ". $1", 'Hello world. Hello world'); > >It searches for a . (comma) with a nonspace character after it and >replaces the whole thing with the . (comma-space) and the non-space >chaacter it have found. > >regards >mmlado
Thanks, works great, I was missing out the () to split the expression up. -- Pete Clark Sunny Andalucia http://hotcosta.com/Andalucia.Spain