Re: grabbing text between two tokens

2008-04-24 Thread Gunnar Hjalmarsson
Sharan Basappa wrote: OTOH, I don't see the point in struggling with Text::Balanced, when all you need is: my @extracted = $source =~ /covergroup.+?endgroup/gs; The example I gave is simple but will become more complex as I keep adding functionality to it. More complex input is yet to c

Re: grabbing text between two tokens

2008-04-24 Thread Sharan Basappa
> OTOH, I don't see the point in struggling with Text::Balanced, when all you > need is: > > my @extracted = $source =~ /covergroup.+?endgroup/gs; The example I gave is simple but will become more complex as I keep adding functionality to it. More complex input is yet to come. Also, I believe

Re: grabbing text between two tokens

2008-04-23 Thread Gunnar Hjalmarsson
Sharan Basappa wrote: On Wed, Apr 23, 2008 at 8:33 PM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: Sharan Basappa wrote: I have gone through the text-balanced doc and tried few examples myself. $text = q{12{abc}12345}; ($extracted, $remainder) = extract_tagged($text, '{', '}'); print "$e

Re: grabbing text between two tokens

2008-04-23 Thread Sharan Basappa
On Wed, Apr 23, 2008 at 8:33 PM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > 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 extr

Re: grabbing text between two tokens

2008-04-23 Thread Gunnar Hjalmarsson
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

Re: grabbing text between two tokens

2008-04-22 Thread Sharan Basappa
On Wed, Apr 16, 2008 at 12:20 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > Sharan Basappa wrote: > > > Gary Stainburn wrote: > > > > > > > > On Monday 14 April 2008 16:35, Sharan Basappa wrote: > > > > > > > > > > I am trying to capture the text between two tokens. These tokens > > > > alway

Re: grabbing text between two tokens

2008-04-15 Thread Gunnar Hjalmarsson
Sharan Basappa wrote: Gary Stainburn wrote: On Monday 14 April 2008 16:35, Sharan Basappa wrote: I am trying to capture the text between two tokens. These tokens always exist in pairs but can occur N times. I somehow dont get what I want. $str =~ m/tokena(.*)tokenb/ms; print $1; Try $str =~

Re: grabbing text between two tokens

2008-04-15 Thread Sharan Basappa
The issue is I have not been able to successfully install a local module so far. I have tried this in the context of Permute module and gave up after spending couple of days. My mail with subject "algorithm/permute.pm" is the one I am talking about Regards, On Mon

Re: grabbing text between two tokens

2008-04-15 Thread Sharan Basappa
actually I tried this before posting this question. The issue is that regex stops after first match. The output is: name: name1 I did put /g at the end, but results are the same. Regards On Mon, Apr 14, 2008 at 9:11 PM, Gary Stainburn <[EMAIL PROTECTED]> wrote: > On Monday 14 April 2008 16:35,

RE: grabbing text between two tokens

2008-04-15 Thread sanket vaidya
008 9:06 PM To: Perl Beginners Subject: grabbing text between two tokens Hi, I am trying to capture the text between two tokens. These tokens always exist in pairs but can occur N times. I somehow dont get what I want. e.g. In the example below, I would like to capture text between tokena and tokenb.

Re: grabbing text between two tokens

2008-04-14 Thread Chas. Owens
On Mon, Apr 14, 2008 at 7:40 PM, <[EMAIL PROTECTED]> wrote: > Thanks Gary, > But some of us may wish to know why $str =~ m/tokena(.*)tokenb/ms; did not > get all the things between tokena and tokenb into $str? > > This is how my mind think:- > (1) The /s switch means to be able to match across

Re: grabbing text between two tokens

2008-04-14 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: Gary Stainburn wrote: On Monday 14 April 2008 16:35, Sharan Basappa wrote: I am trying to capture the text between two tokens. These tokens always exist in pairs but can occur N times. I somehow dont get what I want. $str =~ m/tokena(.*)tokenb/ms; print $1; Try $str

Re: grabbing text between two tokens

2008-04-14 Thread itshardtogetone
1 PM Subject: Re: grabbing text between two tokens On Monday 14 April 2008 16:35, Sharan Basappa wrote: Hi, I am trying to capture the text between two tokens. These tokens always exist in pairs but can occur N times. I somehow dont get what I want. $str =~ m/tokena(.*)tokenb/ms; print $1;

Re: grabbing text between two tokens

2008-04-14 Thread Chas. Owens
On Apr 14, 2008, at 11:35, Sharan Basappa wrote: Hi, I am trying to capture the text between two tokens. These tokens always exist in pairs but can occur N times. I somehow dont get what I want. snip You might consider looking at Text::Balanced*. * http://search.cpan.org/dist/Text-Balanced/l

Re: grabbing text between two tokens

2008-04-14 Thread Gary Stainburn
On Monday 14 April 2008 16:35, Sharan Basappa wrote: > Hi, > > I am trying to capture the text between two tokens. These tokens > always exist in pairs but can occur N times. > I somehow dont get what I want. > > $str =~ m/tokena(.*)tokenb/ms; > print $1; > Try $str =~ m/tokena(.*?)tokenb/ms; The

grabbing text between two tokens

2008-04-14 Thread Sharan Basappa
Hi, I am trying to capture the text between two tokens. These tokens always exist in pairs but can occur N times. I somehow dont get what I want. e.g. In the example below, I would like to capture text between tokena and tokenb. So it should capture name1 and name2. $str = "tokena name: name1 t