ultranerds has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Sorry, the subject isn't very descriptive, but wasn't sure how to describe what I'm trying to do =)
I have this string:
..what I need to do, is has a while () {} which will go through that string, and split it up into the following:
I've tried quite a few regexes, but I can't seem to get them right (I've just ordered the following book - but that won't arrive for a couple of days, I thought it would be worth my while to read it though, as there is still a ton of stuff I don't know about regexes - should of done this years ago!)
http://www.amazon.co.uk/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124/ref=sr_1_3?s=books&ie=UTF8&qid=1294227606&sr=1-3
TIA!
Andy
Sorry, the subject isn't very descriptive, but wasn't sure how to describe what I'm trying to do =)
I have this string:
my $summary = q~[sommaire Bordeaux à test] [[Hébergement à Bordeaux]] [[Gastronomie à Bordeaux]] [[A voir à Bordeaux]] == a sub header === sub header == foo bar === whatever [[Sorties, vie nocturne à Bordeaux]] [[Suggestions pour Bordeaux]] [/sommaire] ~;
..what I need to do, is has a while () {} which will go through that string, and split it up into the following:
var 1: [[Bordeaux|A propos de Bordeaux]] var 2: [[Gastronomie à Bordeaux]] var 3: [[A voir à Bordeaux]] == a sub header === sub header == foo bar === whatever var 4: [[Sorties, vie nocturne à Bordeaux]] var 5: [[Suggestions pour Bordeaux]]
I've tried quite a few regexes, but I can't seem to get them right (I've just ordered the following book - but that won't arrive for a couple of days, I thought it would be worth my while to read it though, as there is still a ton of stuff I don't know about regexes - should of done this years ago!)
http://www.amazon.co.uk/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124/ref=sr_1_3?s=books&ie=UTF8&qid=1294227606&sr=1-3
TIA!
Andy
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Extract content from a string
by Corion (Patriarch) on Jan 05, 2011 at 11:46 UTC | |
by ultranerds (Hermit) on Jan 05, 2011 at 11:48 UTC | |
Re: Extract content from a string
by roboticus (Chancellor) on Jan 05, 2011 at 13:43 UTC | |
Re: Extract content from a string
by tubaandy (Deacon) on Jan 05, 2011 at 14:47 UTC | |
by aartist (Pilgrim) on Jan 06, 2011 at 18:22 UTC |
Back to
Seekers of Perl Wisdom