Re: Help to set up a filter!

2011-01-13 Thread Marek Stepanek
On 12.01.2011 23:15, Doug McNutt wrote: The $ may be referring to the last match as it occurs in a previous loop operation instead of what you think. But why do you need the loop at all? The g flag will repeat each substitute over the whole text if the target is $_ instead of

Re: Help to set up a filter!

2011-01-13 Thread Doug McNutt
At 17:07 +0100 1/13/11, Marek Stepanek wrote: Thank you for your reply. Whether I did not understand your suggestion, or you did not understand my problem :-) The problem was iterating over many naked (with out any html-tags) text in a large text file and tag these found occurrences, and replace

Re: Help to set up a filter!

2011-01-13 Thread Rick
A foreach requires perl to hold the whole file in memory, while the while process a line at a time. Most issues with large files and foreach involve hitting a system memory limit. On Thu, Jan 13, 2011 at 8:07 AM, Marek Stepanek ms...@podiuminternational.org wrote: The problem was iterating

Re: Help to set up a filter!

2011-01-13 Thread Ronald J Kimball
On Thu, Jan 13, 2011 at 02:43:28PM -0800, Rick wrote: A foreach requires perl to hold the whole file in memory, while the while process a line at a time. That entirely depends on the while loop. In this case, Marek read the whole file into memory before the while loop, which is iterating over

Help to set up a filter!

2011-01-12 Thread Marek Stepanek
Hello all! I want to clean up a film script in a bad html shape. I have replaced nearly every thing, which has been formatted by a pre /pre, many white spaces and line breaks. Rest again the many actors texts which are hanging between /p and p tags. To give an example here the original: ...

Re: Help to set up a filter!

2011-01-12 Thread Rick
I recommend HTML::Parser http://search.cpan.org/dist/HTML-Parser/ . -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to

Re: Help to set up a filter!

2011-01-12 Thread Doug McNutt
At 19:12 +0100 1/12/11, Marek Stepanek wrote, and I snipped a bunch: Hello all! #!/usr/bin/perl use strict; use warnings; $/ = undef; $_ = ; foreach ($_ =~ m,(/p\s+[^]+?p),g) { my $paragraf = $1; $paragraf =~ s,/p,$p class=links_normal,; $paragraf =~ s,\n\np$,/pp,g;