I am writing a script to parste rtf into xml and have a number of
questions about regular expressions.

The first is:

I have this line:

\sbknone\linemod0\linex0\cols1\endnhere \pard\plain text\par

I want to split it at the expression "\endnhere". I can either
use 

@array = split(/endnhere/,2);
$first_part_of_line = $array[0];
$second_part_of_line = $array[1];

Or:

$line=~/(.*?)endnhere(.*);
$first_part_of_line = $1;
$second_part_of_line = $2;

Which is quickest? I am using this method repeatedly in my
script, so I wanted the quickest method.

I also have come accross the g anchor. For example:

$line=~/(.*?)endnhere/g;
$rest_of_line=~/\G.*/;

Is it advisable to use this anchor? I know that the $` and $' are
deprecated because they slow down a script (at least according to
*Perl Cookbook*). How about these anchors? They seem like they
would be very useful.

Thanks!

Paul

-- 

************************
*Paul Tremblay         *
*[EMAIL PROTECTED]*
************************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to