我想用br替换所有点,除了数字之间的点和快捷词

时间:2015-05-12 07:49:08

标签: php regex

我想用br替换所有的点,除了数字之间和快捷词之后的点。

例如:

this is my number 1.4 hi dr. david, my name is ayman. how are you. thanks you

转换为

this is my number 1.4 hi dr. david, my name is ayman <br /> how are you <br /> thanks

1 个答案:

答案 0 :(得分:0)

您可以使用负lookbehind/lookahead表达式进行播放。例如

(?<!dr|mr|mrs|miss)\.(?!\d)