in reply to Preserve original text formatting.
i guess it's all related to the split or the join
I would guess so too. You split on /\s+/ but you join with " " so there's clearly going to be a change in the whitespace there if you have anything other than single whitespaces between the words in your input.
Since you check for \b anyway, why not split on that instead and then check each field for an alpha character before doing your comparison? You could then join on ''.
Alternatively look into using one of the many text parsing modules.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Preserve original text formatting.
by larsb (Novice) on Sep 10, 2015 at 13:37 UTC | |
by locked_user sundialsvc4 (Abbot) on Sep 10, 2015 at 13:56 UTC | |
by hippo (Archbishop) on Sep 10, 2015 at 16:46 UTC | |
by larsb (Novice) on Sep 10, 2015 at 16:06 UTC |