Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Text::Balanced with nested / custom brackets

by Anonymous Monk
on Sep 07, 2006 at 22:18 UTC ( #571818=note: print w/replies, xml ) Need Help??


in reply to Re: Text::Balanced with nested / custom brackets
in thread Text::Balanced with nested / custom brackets

Thank you for those regexes! I'll play around with them to see if I can get myself moving.

In the long run, I'd still like to know if Text::Balanced can be massaged into dealing with this situation. It does deal with <tags> and such..

  • Comment on Re^2: Text::Balanced with nested / custom brackets

Replies are listed 'Best First'.
Re^3: Text::Balanced with nested / custom brackets
by ikegami (Pope) on Sep 07, 2006 at 22:36 UTC

    The function to extract tagged data can indeed be used.

    my @links; my $extractor = gen_extract_tagged('[[', ']]', qr/(?:(?!\[\[).)*/); for (;;) { (my $link, $text) = $extractor->($text); last if not defined $link; push(@links, $link); }

    Untested.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://571818]
help
Chatterbox?
[ovedpo15]: consider the following format of strings: some_data-doesn't- matter,value. how I get the value with regex? it should be after the last comma (last string)
[Corion]: Text::CSV_XS for all your CSV file parsing needs. Other than that, what problems do you have with perlre, and capturing everything after the comma? Also, index and substr would also work.
[choroba]: my ($value) = $string =~ /.*,(.*)/

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2018-05-27 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?