【发布时间】:2010-11-06 11:02:52
【问题描述】:
$text =
"<tab><return><nbsp>O'Neil really
likes his pudding's, he really really does!!!1.5"
如果可能的话,我希望有这个'<tab>' 是一个实际的标签\t 空间而不是字面上的'<tab>'
$text = "O'Neil really likes his pudding he really really does 1.5"
删除白色步调,并用一个空格、标点符号替换它们,保留撇号后的数字或任何不是“s”的东西。
非常感谢!
【问题讨论】:
-
O'Neil really likes his auntie's pudding, he really really does!呢? -
为什么
1.5保留它的点? -
@Pekka,我正在尝试制作单词和数字的索引
-
啊,我明白了!那么它就更有意义了。虽然如果输入不正确它会中断 - 很多人倾向于写
his aunties puddings.... -
@Tim,因为它是小数点而不是句点。
标签: php regex preg-replace whitespace string-formatting