php replace regular expression

Posted by Enkay on Stack Overflow See other posts from Stack Overflow or by Enkay
Published on 2010-05-19T14:30:07Z Indexed on 2010/05/19 14:50 UTC
Read the original article Hit count: 294

Filed under:
|
|

I need to use php to add a space between a period and the next word/letter when there's none.

For example, "This is a sentence.This is the next one." needs to become "This is a sentence. This is the next one." Notice the added space after the first period.

My problem is that even if I'm able to make a regular expression that finds every dot followed by a letter, how do I then replace that dot with a "dot + space" and keep the letter?

Also it needs to keep the case of the letter, lower or upper.

Thanks for your input.

© Stack Overflow or respective owner

Related posts about php

Related posts about replace