Welcome to WebmasterWorld Guest from 126.96.36.199
I'm trying to see if there is a way to reformat the following sentence:
"Hello World.This sentence runs into the previous."
"Hello World. This sentence runs into the previous."
Note that the only change in format is an added "space" after the end of the first sentence period.
Can such a replace be done via perl expressions?
I tried the following to no avail:
$my_sentence =~ s/\w\.\w/\w\. \w/g;
Any ideas if this is possible?
s/(?<=[A-Za-z])(\.)\s*(?=[A-Z](?:[a-z]¦ ))/. /g;
This one shouldn't mess up prices or URL's (unless the URL's are mixed-case, which I don't see much of these days). It will ensure exactly one space following qualifying periods, so it will handle too many or too few.
?<= is a lookbehind assertion
?= is a lookahead assertion
[A-Za-z]is a character class