in reply to Way to "trim" part of a phrase?
Once you have divided up the block into phrases, would not a substitution be the most efficient way of stripping the unwanted bits?
s/[^\.!\,\:\)]++[\.!\,\:\)]//I haven't tested this, it is just a thought - i.e. greedy match non-target characters followed by a single target character, and replace it with nothing?
And if you haven't already thought of it Benchmark is good for comparing any alternate ways you can think of doing this. And if speed is really an issue Devel::NYTProf is pretty rock and roll for optimising code usage! HTH!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Way to "trim" part of a phrase?
by ultranerds (Hermit) on Aug 14, 2009 at 08:36 UTC | |
by ultranerds (Hermit) on Aug 14, 2009 at 08:45 UTC | |
by BioLion (Curate) on Aug 14, 2009 at 15:02 UTC |