Thread: Regex for

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

    Join Date
    Aug 2004
    Posts
    358
    Rep Power
    0

    Regex for


    Hi I'm looking regexp for extracting some data from this code. I have this:

    Code:
    				<div class="bubBody">
    					<div class="bible text013">
    				
    						<table class="bibleTable" id="bibleTable" border="0" cellpadding="0" cellspacing="0">
    							<tbody>
    							
    						
    			<tr id="verse_5001">
    				<td><p><a id="ta_5001" rel="tools"><img
    					src="/assets/images/bible/btnT_a.png" alt="Tools specific to Gen 5:1" /></a></p></td>
    				<td><p><img src="/assets/images/copyChkboxOff.gif" alt="Unchecked Copy Box" class="copyBox" data-bible-id="5001" />
    					<a href="/kjv/gen/5/1/s_5001" id="va_5001" rel="tools">Gen 5:1</a></p></td>
    			
    				<td><span class="pMarkers"></span><div class="copyCapable">This&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H2088&amp;t=KJV">H2088</a></sup> <em>is</em> the book&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H5612&amp;t=KJV">H5612</a></sup> of the generations&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H8435&amp;t=KJV">H8435</a></sup> of Adam.&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H121&amp;t=KJV">H121</a></sup> In the day&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H3117&amp;t=KJV">H3117</a></sup> that God&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H430&amp;t=KJV">H430</a></sup> created&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H1254&amp;t=KJV">H1254</a></sup> man,&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H120&amp;t=KJV">H120</a></sup> in the likeness&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H1823&amp;t=KJV">H1823</a></sup> of God&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H430&amp;t=KJV">H430</a></sup> made&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H6213&amp;t=KJV">H6213</a></sup> he him;</div></td>
    			
    			</tr>
      		
    			<tr id="verse_5002">
    				<td><p><a id="ta_5002" rel="tools"><img
    					src="/assets/images/bible/btnT_a.png" alt="Tools specific to Gen 5:2" /></a></p></td>
    				<td><p><img src="/assets/images/copyChkboxOff.gif" alt="Unchecked Copy Box" class="copyBox" data-bible-id="5002" />
    					<a href="/kjv/gen/5/2/s_5002" id="va_5002" rel="tools">Gen 5:2</a></p></td>
    			
    				<td><div class="copyCapable">Male&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H2145&amp;t=KJV">H2145</a></sup> and female&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H5347&amp;t=KJV">H5347</a></sup> created&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H1254&amp;t=KJV">H1254</a></sup> he them; and blessed&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H1288&amp;t=KJV">H1288</a></sup> them, and called&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H7121&amp;t=KJV">H7121</a></sup> their name&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H8034&amp;t=KJV">H8034</a></sup> Adam,&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H120&amp;t=KJV">H120</a></sup> in the day&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H3117&amp;t=KJV">H3117</a></sup> when they were created.&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H1254&amp;t=KJV">H1254</a></sup></div></td>
    			
    			</tr>
      		
    			<tr id="verse_5003">
    				<td><p><a id="ta_5003" rel="tools"><img
    					src="/assets/images/bible/btnT_a.png" alt="Tools specific to Gen 5:3" /></a></p></td>
    				<td><p><img src="/assets/images/copyChkboxOff.gif" alt="Unchecked Copy Box" class="copyBox" data-bible-id="5003" />
    					<a href="/kjv/gen/5/3/s_5003" id="va_5003" rel="tools">Gen 5:3</a></p></td>
    			
    				<td><div class="copyCapable">And Adam&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H121&amp;t=KJV">H121</a></sup> lived&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H2421&amp;t=KJV">H2421</a></sup> an hundred&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H3967&amp;t=KJV">H3967</a></sup> and thirty&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H7970&amp;t=KJV">H7970</a></sup> years,&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H8141&amp;t=KJV">H8141</a></sup> and begat&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H3205&amp;t=KJV">H3205</a></sup> <em>a son</em> in his own likeness,&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H1823&amp;t=KJV">H1823</a></sup> after his image;&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H6754&amp;t=KJV">H6754</a></sup> and called&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H7121&amp;t=KJV">H7121</a></sup> his name&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H8034&amp;t=KJV">H8034</a></sup> Seth:&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H8352&amp;t=KJV">H8352</a></sup></div></td>
    			
    			</tr>
    </table>
    And I want this:
    Code:
    <table>
     <tbody>
    <tr>
    <td style="background-color: #eae8c8; border: 1px solid #7A1010; height: 118px; padding: 10px 10px 10px 10px; width: 169px;" valign="top"><span style="font-size: 14px;"><a href="http://www.blueletterbible.org/Bible.cfm?b=gen&amp;c=5&amp;t=KJV" target="_blank">Genesis 5</a> - <a href="https://www.blueletterbible.org/audio_video/popPlayer.cfm?type=kjv_n&amp;b=1&amp;c=5" target="_blank">Listen</a></span>
    
    <br />
    <br />
    <span style="font-size: smaller; font-weight: bold; vertical-align: text-top; font-weight: bold;">1</span> <span style="color: #003; font-weight: bold;" title="[H2088] - zeh">This</span> [is] the <span style="color: #030; font-weight: bold;" title="[H5612] - cepher from [H5608] - caphar">book</span> of the <span style="color: #303; font-weight: bold;" title="[H8435] - towledah from [H3205] - yalad also [H3206] - yeled also [H3207] - yaldah also [H3209] - yillowd">generations</span> of <span style="color: #006; font-weight: bold;" title="[H121] - 'Adam from [H120] - 'adam and [H119] - 'adam and [H122] - 'adom and [H123] - 'Edom and [H124] - 'odem and [H125] - 'adamdam and [H126] - 'Admah and [H127] - 'adamah and [H128] - 'Adamah and [H129] - 'Adamiy and [H130] - 'Edomiy and [H131] - 'Adummiym and [H132] - 'admoniy and [H133] - 'Admatha">Adam</span>. In the <span style="color: #060; font-weight: bold;" title="[H3117] - yowm also [H3118] - yowm (Aramaic) and [H3119] - yowmam">day</span> that <span style="color: #90F; font-weight: bold;" title="[H430] - 'elohiym from [H433] - 'elowahh">God</span> <span style="color: #600; font-weight: bold;" title="[H1254] - bara'">created</span> <span style="color: #006; font-weight: bold;" title="[H120] - 'adam and [H119] - 'adam and [H122] - 'adom and [H123] - 'Edom and [H124] - 'odem and [H125] - 'adamdam and [H126] - 'Admah and [H127] - 'adamah and [H128] - 'Adamah and [H129] - 'Adamiy and [H130] - 'Edomiy and [H131] - 'Adummiym and [H132] - 'admoniy and [H133] - 'Admatha also [H121] - 'Adam">man</span>, in the <span style="color: #009; font-weight: bold;" title="[H1823] - demuwth and [H1819] - damah">likeness</span> of <span style="color: #90F; font-weight: bold;" title="[H430] - 'elohiym from [H433] - 'elowahh">God</span> <span style="color: #396; font-weight: bold;" title="[H6213] - `asah also [H4640] - Ma`say also [H4641] - Ma`aseyah also [H6214] - `Asah'el also [H4639] - ma`aseh">made</span> he him;
    
    <br />
    <br />
    <span style="font-size: smaller; font-weight: bold; vertical-align: text-top; font-weight: bold;">2</span> <span style="color: #900; font-weight: bold;" title="[H2145] - zakar and [H2142] - zakar">Male</span> and <span style="color: #00C; font-weight: bold;" title="[H5347] - neqebah from [H5344] - naqab">female</span> <span style="color: #600; font-weight: bold;" title="[H1254] - bara'">created</span> he them; and <span style="color: #0C0; font-weight: bold;" title="[H1288] - barak also [H1289] - berak (Aramaic) and [H1290] - berek and [H1291] - berek (Aramaic) and [H1293] - Berakah">blessed</span> them, and <span style="color: #C00; font-weight: bold;" title="[H7121] - qara' from [H7122] - qara' and [H7123] - qera' (Aramaic) and [H7125] - qir'ah">called</span> their <span style="color: #00F; font-weight: bold;" title="[H8034] - shem from [H7760] - suwm and [H8035] - Shem and [H8033] - sham and [H8036] - shum (Aramaic)">name</span> <span style="color: #006; font-weight: bold;" title="[H120] - 'adam and [H119] - 'adam and [H122] - 'adom and [H123] - 'Edom and [H124] - 'odem and [H125] - 'adamdam and [H126] - 'Admah and [H127] - 'adamah and [H128] - 'Adamah and [H129] - 'Adamiy and [H130] - 'Edomiy and [H131] - 'Adummiym and [H132] - 'admoniy and [H133] - 'Admatha also [H121] - 'Adam">Adam</span>, in the <span style="color: #060; font-weight: bold;" title="[H3117] - yowm also [H3118] - yowm (Aramaic) and [H3119] - yowmam">day</span> when they were <span style="color: #600; font-weight: bold;" title="[H1254] - bara'">created</span>.
    
    <br />
    <br />
    <span style="font-size: smaller; font-weight: bold; vertical-align: text-top; font-weight: bold;">3</span> And <span style="color: #006; font-weight: bold;" title="[H121] - 'Adam from [H120] - 'adam and [H119] - 'adam and [H122] - 'adom and [H123] - 'Edom and [H124] - 'odem and [H125] - 'adamdam and [H126] - 'Admah and [H127] - 'adamah and [H128] - 'Adamah and [H129] - 'Adamiy and [H130] - 'Edomiy and [H131] - 'Adummiym and [H132] - 'admoniy and [H133] - 'Admatha">Adam</span> <span style="color: #9CF; font-weight: bold;" title="[H2421] - chayah also [H2340] - Chivviy from [H2333] - chavvah and [H2332] - Chavvah and [H2331] - chavah and [H2324] - chava' (Aramaic) also [H2425] - chayay">lived</span> an <span style="color: #0F0; font-weight: bold;" title="[H3967] - me'ah also [H3968] - Me'ah and [H3969] - ma'ah (Aramaic)">hundred</span> and <span style="color: #F00; font-weight: bold;" title="[H7970] - shelowshiym from [H7969] - shalowsh">thirty</span> <span style="color: #033; font-weight: bold;" title="[H8145] - sheniy also [H8138] - shanah also [H8148] - sheniynah also [H8150] - shanan also [H8146] - saniy also [H8144] - shaniy' also [H8147] - shenayim also [H8141] - shaneh (in pl. only) from [H8138] - shanah also [H8140] - shenah (Aramaic)">years</span>, and <span style="color: #303; font-weight: bold;" title="[H3205] - yalad also [H3206] - yeled also [H3207] - yaldah also [H3209] - yillowd also [H8435] - towledah">begat</span> [a son] in his own <span style="color: #009; font-weight: bold;" title="[H1823] - demuwth and [H1819] - damah">likeness</span>, after his <span style="color: #330; font-weight: bold;" title="[H6754] - tselem also [H6755] - tselem (Aramaic) also [H6756] - Tsalmown">image</span>; and <span style="color: #C00; font-weight: bold;" title="[H7121] - qara' from [H7122] - qara' and [H7123] - qera' (Aramaic) and [H7125] - qir'ah">called</span> his <span style="color: #00F; font-weight: bold;" title="[H8034] - shem from [H7760] - suwm and [H8035] - Shem and [H8033] - sham and [H8036] - shum (Aramaic)">name</span> <span style="color: #066; font-weight: bold;" title="[H8352] - Sheth from [H7896] - shiyth also [H7897] - shiyth also [H7898] - shayith">Seth</span>:</td>
    			
    			</tr>
    </table>
    TO be more specific, I want this:
    Code:
    <td><div class="copyCapable">Male&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H2145&amp;t=KJV">H2145</a></sup> and female&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H5347&amp;t=KJV">H5347</a></sup> created&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H1254&amp;t=KJV">H1254</a></sup> he them; and blessed&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H1288&amp;t=KJV">H1288</a></sup> them, and called&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H7121&amp;t=KJV">H7121</a></sup> their name&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H8034&amp;t=KJV">H8034</a></sup> Adam,&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H120&amp;t=KJV">H120</a></sup> in the day&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H3117&amp;t=KJV">H3117</a></sup> when they were created.&nbsp;<sup><a href="/lang/Lexicon/Lexicon.cfm?strongs=H1254&amp;t=KJV">H1254</a></sup></div></td>
    To be this:
    Code:
    <br />
    <br />
    <span style="font-size: smaller; font-weight: bold; vertical-align: text-top; font-weight: bold;">1</span> <span style="color: #003; font-weight: bold;" title="[H2088] - zeh">This</span> [is] the <span style="color: #030; font-weight: bold;" title="[H5612] - cepher from [H5608] - caphar">book</span> of the <span style="color: #303; font-weight: bold;" title="[H8435] - towledah from [H3205] - yalad also [H3206] - yeled also [H3207] - yaldah also [H3209] - yillowd">generations</span> of <span style="color: #006; font-weight: bold;" title="[H121] - 'Adam from [H120] - 'adam and [H119] - 'adam and [H122] - 'adom and [H123] - 'Edom and [H124] - 'odem and [H125] - 'adamdam and [H126] - 'Admah and [H127] - 'adamah and [H128] - 'Adamah and [H129] - 'Adamiy and [H130] - 'Edomiy and [H131] - 'Adummiym and [H132] - 'admoniy and [H133] - 'Admatha">Adam</span>. In the <span style="color: #060; font-weight: bold;" title="[H3117] - yowm also [H3118] - yowm (Aramaic) and [H3119] - yowmam">day</span> that <span style="color: #90F; font-weight: bold;" title="[H430] - 'elohiym from [H433] - 'elowahh">God</span> <span style="color: #600; font-weight: bold;" title="[H1254] - bara'">created</span> <span style="color: #006; font-weight: bold;" title="[H120] - 'adam and [H119] - 'adam and [H122] - 'adom and [H123] - 'Edom and [H124] - 'odem and [H125] - 'adamdam and [H126] - 'Admah and [H127] - 'adamah and [H128] - 'Adamah and [H129] - 'Adamiy and [H130] - 'Edomiy and [H131] - 'Adummiym and [H132] - 'admoniy and [H133] - 'Admatha also [H121] - 'Adam">man</span>, in the <span style="color: #009; font-weight: bold;" title="[H1823] - demuwth and [H1819] - damah">likeness</span> of <span style="color: #90F; font-weight: bold;" title="[H430] - 'elohiym from [H433] - 'elowahh">God</span> <span style="color: #396; font-weight: bold;" title="[H6213] - `asah also [H4640] - Ma`say also [H4641] - Ma`aseyah also [H6214] - `Asah'el also [H4639] - ma`aseh">made</span> he him;
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    358
    Rep Power
    0
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    358
    Rep Power
    0
  6. #4
  7. Lord of the Dance
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Oct 2003
    Posts
    4,131
    Rep Power
    2010
    It would be better to use some DOM parse or similar.

    Maybe you can add what you have tried?
    It is not clear what you want; what do you need to find, change, etc.?

IMN logo majestic logo threadwatch logo seochat tools logo