Sharan Basappa wrote:
I have gone through the text-balanced doc and tried few examples myself. Looks like I need some help on this module usage and capabilities. Basically the text I am trying to extract is embedded inside two tokens (say {}), but it can occur anywhere in the input text stream. I tried using extract_tagged function, but that seems to succeed only if the text starts with the tag I am specifying. For example, the following example returns expected value (i.e. {abc}):
<snip>
$text = q{{abc}12345}; ($extracted, $remainder) = extract_tagged($text, '{', '}'); print "$extracted \n"; The following example does not (difference is that $text does not start with {):
<snip>
$text = q{12{abc}12345}; ($extracted, $remainder) = extract_tagged($text, '{', '}'); print "$extracted \n";
You need a prefix pattern as the fourth argument, e.g. '[\w\s]+'
The other question I have is that I would like to use text-balanced module to extract multiple occurences of these strings that are tagged by these tokens. Is that possible?
Use the extract_multiple() function. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/