Punctuation String diff: preg_split answer?

http://piratepad.net/IY48xXzsys (modified by Peter West, from the original here: http://paulbutler.org/archives/a-simple-diff-algorithm-in-php/ )

Currently, the distinction between “I think therefore” and “I think therefore” will produce:

I < del >think,< /del >< ins >think< /ins > therefore

I would like it to produce:

I think< del >,< /del > therefore

I think the answer will be to include the comma as a separate object in the array, which is the result of the function preg_split. I tried to play with parentheses but couldn't make it work. Can you help me?

+3
source share
1 answer

I think adding comma separators in the call splitwill do this.

0
source

All Articles