Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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:

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

In reply to Extract content from a string by ultranerds

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2022-12-08 10:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?