#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    5
    Rep Power
    0

    How do i match everything between <ul to </ul>?


    <ul class="footnotes">
    <li id="FN_Footnote-MAT-1"><a href="#Footnote-MAT-1">[]</a> 1.2–6a Tamar Bore her twin sons out of wedlock (Gen 38.6–30).</li>

    <li id="FN_Footnote-MAT-2"><a href="#Footnote-MAT-2">[]</a> 1.2–6a Rahab A PROSTITUTE in Jericho (Josh 2.1–21; 6.17–25; Jas 2.25).</li>

    <li id="FN_Footnote-MAT-3"><a href="#Footnote-MAT-3">[]</a> 1.2–6a Ruth A MOABITE (Ruth 1.4). Only outstanding women were normally included in Jewish genealogical lists.</li>

    <li id="FN_Footnote-MAT-4"><a href="#Footnote-MAT-4">[]</a> 1.6b–11 Solomon In Luke's genealogy (Lk 3.31) David's son Nathan (2 Sam 5.14) appears as Jesus' ancestor.</li>

    <li id="FN_Footnote-MAT-5"><a href="#Footnote-MAT-5">[]</a> 1.6b–11 his mother Bathsheba (2 Sam 12.24).</li>

    <li id="FN_Footnote-MAT-6"><a href="#Footnote-MAT-6">[]</a> 1.6b–11 exile in Babylon In 597 BC King Nebuchadnezzar of Babylonia conquered JERUSALEM and took many of its inhabitants as prisoners to his country (2 Kgs 24.10–16; 2 Chr 36.9–10; Jer 27.20).</li>

    <li id="FN_Footnote-MAT-8"><a href="#Footnote-MAT-8">[]</a> 1.12–16 after the exile in Babylon In 538 BC Emperor CYRUS of Persia, who the year before had conquered Babylon, allowed the Jews to return to their homeland.</li>

    <li id="FN_Footnote-MAT-9"><a href="#Footnote-MAT-9">[]</a> 1.12–16 Zerubbabel Leader of the Jewish people after they returned from exile (Ezra 3.2; Hag 1.1; 2.2; Zech 4.6–10).</li>

    <li id="FN_Footnote-MAT-10"><a href="#Footnote-MAT-10">[]</a> 1.12–16 MESSIAH</li>

    <li id="FN_Footnote-MAT-11"><a href="#Footnote-MAT-11">[]</a> 1.17 fourteen generations The number may be related to the numerical value of the name David in Hebrew: d (4) +v (6) +d (4) = 14.</li>
    </ul>
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,647
    Rep Power
    1945
    try with:
    /<ul.*<\/ul>/s
  4. #3
  5. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,070
    Rep Power
    9398
    Even better than regular expressions: use an HTML parser to find the UL and grab its HTML contents.

    Comments on this post

    • Jacques1 agrees
    • Laurent_R agrees
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    5
    Rep Power
    0
    Originally Posted by requinix
    Even better than regular expressions: use an HTML parser to find the UL and grab its HTML contents.
    will that enable me to extract all <ul </ul> and move it somewhere else? I looked it up on their website but it doesn't explain it massively well (im quite new to HTML if you haven't guessed already)
  8. #5
  9. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    "Their website"? Who is "they"?

    The thing is that regexes are dumb. They don't understand the input, all they see is a sequence of characters. Sometimes you can process a simple HTML snippet by only looking at the characters. But in general, this is the wrong way. It's extremely cumbersome, inflexible and difficult to read. And it only works in very simple cases.

    The correct solution as pointed out by requinix is to use an HTML parser which actually understands the stuff you're giving it. Once the raw markup has been turned into a structure of elements, you can do anything you want: You can move the elements around, add new ones, change the attributes etc.

    Regexes are overrated. They work well for simple patterns like timestamps. But they're completely unsuitable for anything more complex. Whenever you have to deal with a complicated structure like an HTML document, you need a real parser.

    Comments on this post

    • Laurent_R agrees
    The 6 worst sins of security • How to (properly) access a MySQL database with PHP

    Why can’t I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo