Equivalent to mysql regex - mysql

Mysql regex equivalent for this pattern:
<table (.+)width:(.+)px
I tried putting this pattern in my query but it will still hit items that doesn't have the pattern.
I use this site to check if the item hits that pattern above:
https://regex101.com/
This is my query:
select * from wp_posts where post_content regexp '<table (.+)width:(.+)px';
This is the my sample post_content that is correct:
<table class="table-schedule" style="width: 737px;">
<tbody>
<tr>
<th>営業時間</th>
<th>月</th>
<th>火</th>
<th>水</th>
<th>木</th>
<th>金</th>
<th class="holiday">土</th>
<th class="holiday">日</th>
<th class="holiday">祝</th>
</tr>
<tr>
<td>11:00~19:00</td>
<td class="weekday maru">○</td>
<td class="weekday maru">休</td>
<td class="weekday maru">○</td>
<td class="weekday maru">○</td>
<td class="weekday maru">○</td>
<td class="holiday">○</td>
<td class="holiday">○</td>
<td class="holiday">○</td>
</tr>
</tbody>
</table>
This is the other sample post_content that is wrong. That will still hit even though there's no width on the table:
<table class="table-schedule">
<tbody>
<tr>
<th>営業時間</th>
<th>月</th>
<th>火</th>
<th>水</th>
<th>木</th>
<th>金</th>
<th class="holiday">土</th>
<th class="holiday">日</th>
<th class="holiday">祝</th>
</tr>
<tr>
<td style="text-align: center;">
<p>11:00~19:00</p>
</td>
<td class="weekday maru" style="text-align: center;">○</td>
<td class="weekday maru" style="text-align: center;">休</td>
<td class="weekday maru" style="text-align: center;">○</td>
<td class="weekday maru" style="text-align: center;">休</td>
<td class="weekday maru" style="text-align: center;">○</td>
<td class="holiday" style="text-align: center;">休</td>
<td class="holiday" style="text-align: center;">休</td>
<td class="holiday" style="text-align: center;">休</td>
</tr>
<tr>
<td style="text-align: center;">
<p>11:00~17:00</p>
</td>
<td style="text-align: center;">休</td>
<td style="text-align: center;">○</td>
<td style="text-align: center;">休</td>
<td style="text-align: center;">○</td>
<td style="text-align: center;">休</td>
<td style="text-align: center;">○</td>
<td style="text-align: center;">休</td>
<td style="text-align: center;">休</td>
</tr>
</tbody>
</table>
Note: mysql version 5.6

While your current regex pattern is valid, it won't behave the way you want, because the (.+) terms might match across tags. Try this version:
SELECT *
FROM wp_posts
WHERE post_content REGEXP '<table [^>]+width: [0-9]+px';
Demo

Related

I need help to split a cell into two columns

Just like how in the image I linked "tache1" and "tache2" in the 4th row are splitting "Mercredi" in two
<table width="400" border="2" cellspacing="1" cellpadding="1">
<tr>
<th width="15%" rowspan="2">Equipes</th>
<th width="70%" colspan="5">Janvier</th>
<td width="15%" rowspan="2"></td>
</tr>
<tr>
<th>Lundi</th>
<th>Mardi</th>
<th>Mercredi</th>
<th>Jeudi</th>
<th>Vendredi</th>
</tr>
<tr>
<td rowspan="2">Equipe1</td>
<td colspan="3">tache1</td>
<td colspan="2">tache2</td>
<td rowspan="2">Semaine1</td>
</tr>
<tr>
<td colspan="2">tache1</td>
<td colspan="3">tache2</td>
</tr>
</table>
Use 6 colspan instead of 5 in <th width="70%" colspan="6">Janvier</th> Then use 2 colspan for Mercredi like this <th colspan="2">Mercredi</th> Then use 3 colspan for each tache like this
<td colspan="3">tache1</td>
<td colspan="3">tache2</td>
Also In your setup, Equip1 is taking 2 rows but its content to the right take only 1 row.
so use rowspan"1" for both Equipe1 and 2.
<table width="600" border="2" cellspacing="1" cellpadding="1">
<tr>
<th width="15%" rowspan="2">Equipes</th>
<th width="70%" colspan="6">Janvier</th>
<td width="15%" rowspan="2"></td>
</tr>
<tr>
<th>Lundi</th>
<th>Mardi</th>
<th colspan="2">Mercredi</th>
<th>Jeudi</th>
<th>Vendredi</th>
</tr>
<tr>
<td rowspan="1">Equipe1</td>
<td colspan="3">tache1</td>
<td colspan="3">tache2</td>
<td rowspan="2">Semaine1</td>
</tr>
<tr>
<td rowspan="1">Equipe2</td>
<td colspan="3">tache1</td>
<td colspan="3">tache2</td>
</tr>
</table>

How to fetch whole row from HTML data through shell script?

I need to fetch whole row from table for that I have taken the table data into HTML format(Please see below data). Now I need to get data for a specific row Ex is suppose I want data for 19.8.2 then whole ROW should be fetched from 8/19/19(Branch cut) to 8/23/19(Prod Deploy)--
<div class="table-wrap">
<table class="wrapped confluenceTable">
<colgroup>
<col style="width: 123.0px;" />
<col style="width: 80.0px;" />
<col style="width: 138.0px;" />
<col style="width: 138.0px;" />
<col style="width: 139.0px;" />
<col style="width: 126.0px;" />
<col style="width: 788.0px;" />
</colgroup>
<tbody>
<tr>
<td class="highlight-green confluenceTd" data-highlight-colour="green">Milestone</td>
<td class="highlight-green confluenceTd" data-highlight-colour="green">Branch Cut</td>
<td class="highlight-green confluenceTd" data-highlight-colour="green">FIT Cert</td>
<td class="highlight-green confluenceTd" data-highlight-colour="green">IAT Cert</td>
<td class="highlight-green confluenceTd" data-highlight-colour="green">UAT Deploy</td>
<td class="highlight-green confluenceTd" data-highlight-colour="green">Prod Deploy</td>
<td class="highlight-green confluenceTd" colspan="1" data-highlight-colour="green">Key Features</td>
</tr>
<tr>
<td colspan="1" class="confluenceTd">19.7.1</td>
<td colspan="1" class="confluenceTd">7/8/19</td>
<td colspan="1" class="confluenceTd">7/9/19</td>
<td colspan="1" class="confluenceTd">7/10/19</td>
<td colspan="1" class="confluenceTd">7/11/19</td>
<td colspan="1" class="confluenceTd">7/12/19</td>
<td colspan="1" class="confluenceTd">
<p><span style="color: rgb(51,153,102);">MOVE TO 3 WEEK RELEASE CYCLE ON FRIDAYS</span></p>
</td>
</tr>
<tr>
<td colspan="1" class="confluenceTd">19.8.1</td>
<td colspan="1" class="confluenceTd">7/29/19</td>
<td colspan="1" class="confluenceTd">7/30/19</td>
<td colspan="1" class="confluenceTd">7/31/19</td>
<td colspan="1" class="confluenceTd">8/1/19</td>
<td colspan="1" class="confluenceTd">8/2/19</td>
<td colspan="1" class="confluenceTd">
<br/>
</td>
</tr>
<tr>
<td colspan="1" class="confluenceTd">19.8.2</td>
<td colspan="1" class="confluenceTd">8/19/19</td>
<td colspan="1" class="confluenceTd">8/20/19</td>
<td colspan="1" class="confluenceTd">8/21/19</td>
<td colspan="1" class="confluenceTd">8/22/19</td>
<td colspan="1" class="confluenceTd">8/23/19</td>
<td colspan="1" class="confluenceTd">
<br/>
</td>
</tr>
<tr>
<td colspan="1" class="confluenceTd">19.9.1</td>
<td colspan="1" class="confluenceTd">9/9/19</td>
<td colspan="1" class="confluenceTd">9/10/19</td>
<td colspan="1" class="confluenceTd">9/11/19</td>
<td colspan="1" class="confluenceTd">9/12/19</td>
<td colspan="1" class="confluenceTd">9/13/19</td>
<td colspan="1" class="confluenceTd">
<br/>
</td>
</tr>
<tr>
<td class="confluenceTd">19.10.1</td>
<td class="confluenceTd">9/30/19</td>
<td class="confluenceTd">10/1/19</td>
<td class="confluenceTd">10/2/19</td>
<td class="confluenceTd">10/3/19</td>
<td class="confluenceTd">10/4/19</td>
<td class="confluenceTd"><span>Q1 - Feature Release</span></td>
</tr>
<tr>
<td class="confluenceTd">19.10.2</td>
<td class="confluenceTd">
<br/>
</td>
<td class="confluenceTd">
<br/>
</td>
<td class="confluenceTd">
<br/>
</td>
<td class="confluenceTd">
<br/>
</td>
<td class="confluenceTd">
<br/>
</td>
<td class="confluenceTd">
<p>This deployment was canceled due to a dev group directed deployment freeze.</p>
<p>Original Dates: Branch: 10/21; FIT: 10/22; IAT: 10/23; UAT: 10/24; Prod: 10/25</p>
</td>
</tr>
<tr>
<td class="confluenceTd">19.11.1</td>
<td class="confluenceTd">11/11/19</td>
<td class="confluenceTd">11/12/19</td>
<td class="confluenceTd">11/13/19</td>
<td class="confluenceTd">11/14/19</td>
<td class="confluenceTd">11/15/19</td>
<td class="confluenceTd">
<br/>
</td>
</tr>
<tr>
<td class="confluenceTd">19.12.1</td>
<td class="confluenceTd">12/2/19</td>
<td class="confluenceTd">12/3/19</td>
<td class="confluenceTd">12/4/19</td>
<td class="confluenceTd">12/5/19</td>
<td class="confluenceTd">12/6/19</td>
<td class="confluenceTd">
<br/>
</td>
</tr>
<tr>
<td colspan="1" class="confluenceTd">20.01.1</td>
<td colspan="1" class="confluenceTd">1/20/20</td>
<td colspan="1" class="confluenceTd">1/21/20</td>
<td colspan="1" class="confluenceTd">1/22/20</td>
<td colspan="1" class="confluenceTd">1/23/20</td>
<td colspan="1" class="confluenceTd">1/24/20</td>
<td colspan="1" class="confluenceTd">Q2 - Feature Release</td>
</tr>
</tbody>
</table>
</div>
<p>** FIT certification delayed 1 day due to Holiday</p>
I tried with below script but getting output is only branch cut column date-Please help.
#!/bin/bash
curl -user -pass --noproxy '*' 'https://confluence.es.com/display/Release+Calendar' | awk ' /<div id="main-content" class="wiki-content">/ {flag=1;next} / <\\/div>/{flag=0} flag { print }' > page.tmp
xmllint --html -xpath'//table/tbody/tr/td[2]' page.tmp | egrep -o '[0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4}' > branchdates.tmp
You will have to get required td and then parent tr of that td. You can do this with following xpath
To get required td
//table//td[contains(text(), '19.8.2')]
To get parent tr of required td
//table//td[contains(text(), '19.8.2')]/parent::tr

HTML & CSS: row in colum in the table

I am creating a table but I am having trouble in the last panel (Condition). I want the table have 2 rows but I have tried and failed, how to create in a 2 row colum?
likely this image
I tried everything but could not, you can explain it to me
Thank a lot
<table id="items">
<tr>
<th width="25%">Prestation</th>
<th width="10%">Prix Unitaire</th>
<th width="10%">Quantity</th>
<th width="10%">Montant</th>
<th width="45%">Condition</th>
</tr>
<tr class="item-row">
<td class="item-name">
<div class="delete-wpr"><input type="text" style="width: px; height: 47px;"><a class="delete" href="javascript:;" title="Remove row">X</a></div>
</td>
<td><input type="text" class="cost" style="width: 100px; height: 47px;"></td>
<td><input type="text" class="qty" style="width: 60px; height: 47px;"></td>
<td><span class="price"></span></td>
<tr class="condition">
</tr>
<tr id="hiderow">
<td colspan="5"><a id="addrow" href="javascript:;" title="Add a row">Add a row</a></td>
</tr>
<tr>
<td colspan="1" class="blank"> </td>
<td colspan="2" class="total-line">Subtotal</td>
<td class="total-value">
<div id="subtotal"></div>
</td>
</tr>
<tr>
<td colspan="1" class="blank"> </td>
<td colspan="2" class="total-line">Total</td>
<td class="total-value">
<div id="total"></div>
</td>
</tr>
<tr>
<td colspan="1" class="blank"> </td>
<td colspan="2" class="total-line">Montant payé</td>
<td class="total-value"><input type="text" id="paid" style="width: 50px; heigth: ;"></td>
</tr>
<tr>
<td colspan="1" class="blank"> </td>
<td colspan="2" class="total-line balance">Solde dû</td>
<td class="total-value balance">
<div class="due"></div>
</td>
</tr>
</table>
I am not sure about your question. If you mean, have one column in 2 row, try use rowspan="2" in tag <row> instead of colspan.
Colspan will stretch one column through columns.
Rowspan will
stretch one row through rows.

CSS Table with Alternating Colour Rows

Hello I was wondering if it's possible with a css table to have alternating colour rows? I would like it to look like this,
http://i.imgur.com/zT04atv.jpg
My code so far for the table is this. I have tried but just can't seem to get it to work. Is this possible? And if so how would I implement it? Thanks.
<table style="height: 448px;" width="1007">
<tbody>
<tr>
<td style="text-align: center;">
<p>Pricing</p>
<p>Structure</p>
</td>
<td style="text-align: center;">
<p>Professional</p>
<p>Resume</p>
<p>$199</p>
</td>
<td style="text-align: center;">
<p>Managerial</p>
<p>Resume</p>
<p>$299</p>
</td>
<td style="text-align: center;">
<p>Executive</p>
<p>Resume</p>
<p>$399</p>
</td>
<td style="text-align: center;">
<p>C-Suite</p>
<p>Resume</p>
<p>$499</p>
</td>
</tr>
<tr>
<td style="text-align: center;">Resume Specs</td>
<td style="text-align: center;">2-3 pg resume</td>
<td style="text-align: center;">4-5 pg resume</td>
<td style="text-align: center;">
<p>+ cover sheet and</p>
<p>graphics</p>
</td>
<td style="text-align: center;">+ standalone bio pg</td>
</tr>
<tr>
<td style="text-align: center;">Phone Interview</td>
<td style="text-align: center;">Tick</td>
<td style="text-align: center;">Tick</td>
<td style="text-align: center;">Tick</td>
<td style="text-align: center;">
<p>Tick</p>
</td>
</tr>
<tr>
<td style="text-align: center;">Draft To Approve</td>
<td style="text-align: center;">Tick</td>
<td style="text-align: center;">Tick</td>
<td style="text-align: center;">Tick</td>
<td style="text-align: center;">Tick</td>
</tr>
<tr>
<td style="text-align: center;">Template Options</td>
<td style="text-align: center;"> </td>
<td style="text-align: center;"> </td>
<td style="text-align: center;">Tick</td>
<td style="text-align: center;">Tick</td>
</tr>
<tr>
<td style="text-align: center;">Extras</td>
<td style="text-align: center;"> </td>
<td style="text-align: center;"> </td>
<td style="text-align: center;">
<p>+ Free LinkedIn</p>
<p>profile</p>
</td>
<td style="text-align: center;">
<p>+ Free LinkedIn</p>
<p>profile</p>
</td>
</tr>
<tr>
<td style="text-align: center;">Delivery</td>
<td style="text-align: center;">
<p>.docx & .pdf</p>
<p>versions</p>
</td>
<td style="text-align: center;">
<p>.docx & .pdf</p>
<p>versions</p>
</td>
<td style="text-align: center;">
<p>.docx & .pdf</p>
<p>versions</p>
</td>
<td style="text-align: center;">
<p>.docx & .pdf</p>
<p>versions</p>
</td>
</tr>
<tr>
<td style="text-align: center;">Cover Letter</td>
<td style="text-align: center;">+ $50</td>
<td style="text-align: center;">+ $50</td>
<td style="text-align: center;">+ $50</td>
<td style="text-align: center;">+ $50</td>
</tr>
<tr>
<td style="text-align: center;">
<p>If your not sure where</p>
<p>your job would fit, please</p>
<p>get in touch to discuss </p>
<p>your arrangements</p>
</td>
<td style="text-align: center;">
<p>Vocations (such as</p>
<p>teaching & nursing)</p>
<p>Early career professionals</p>
</td>
<td style="text-align: center;">
<p>Managers and Senior</p>
<p>professionals (lawyers,</p>
<p>medical doctors), BDM's</p>
<p>consultants...</p>
</td>
<td style="text-align: center;">
<p>Senior Managers and Exec</p>
<p>Directors (Operations</p>
<p>Managers, GMs, Head of</p>
<p>Department</p>
</td>
<td style="text-align: center;">
<p>CEOs, CFOs, COOs, CIOs,</p>
<p>Managing Directors, Board</p>
<p>Members & Non-Execs,</p>
<p>Practice Directors & Principals</p>
</td>
</tr>
</tbody>
</table>
You can use the CSS3 that allows to put style to the odd or even elements of a selector.
td:nth-child(odd) {
background: #ff0000;
}
td:nth-child(even) {
background: #0000ff;
}

HTML: Unexpected double row using rowspan

I want to create a normal table. But I need to put two fields in one row.
So, I used rowspan and expected to have a two row table, but with a space of fourth.
But, it's showed in only one line.
I revised, and look for something wrong, but I dont unerstaing.
When I remove the rowspan, everything looks normal, but I need the rowspan.
Why is render in one row?
<table class="table table-bordered">
<tbody>
<tr class="warning" >
<td rowspan="2" >100</td>
<td rowspan="2">87</td>
<td rowspan="2">FERNANDO RODRIGUEZ</td>
<td rowspan="2"></td>
<td rowspan="2">MARIANO ORTEGA SANCHEZ</td>
<td rowspan="2" > </td>
<td rowspan="2" > </td>
<td rowspan="2">
<span class="label label-info">
Importacion
Sencillo
</span>
</td>
<td rowspan="2"> Monterrey </td>
<td rowspan="2" ></td>
<td rowspan="2" ></td>
<td rowspan="2" ></td>
<td rowspan="2">
<a href="/TimsaLzc/web/app_dev.php/main/fleteDetalle/100" >
<button class="btn btn-success">Detalles</button>
</a>
</td>
</tr>
<tr class="warning" >
<td rowspan="2" >101</td>
<td rowspan="2">82</td>
<td rowspan="2">IVAN CORTES</td>
<td rowspan="2"></td>
<td rowspan="2">MARIANO ORTEGA SANCHEZ</td>
<td rowspan="2" > </td>
<td rowspan="2" > </td>
<td rowspan="2">
<span class="label label-info">
Importacion
Sencillo
</span>
</td>
<td rowspan="2"> Nissan Mexico </td>
<td rowspan="2" ></td>
<td rowspan="2" ></td>
<td rowspan="2" ></td>
<td rowspan="2">
<a href="/TimsaLzc/web/app_dev.php/main/fleteDetalle/101" >
<button class="btn btn-success">Detalles</button>
</a>
</td>
</tr>
</tbody>
</table>
This is a picture of my app in action, and the reason of my question.
https://www.dropbox.com/s/1luaxgg4yesm8re/result.png
Replace the rowspans with colspans. For example:
<td colspan="2">
(...)
</td>
EDIT:
Still not 100% sure what you're trying to achieve but as far as I believe you might want to:
remove rowspan from all the td's that are meant to be two-rowed.
add and additional <tr></tr> after each tr and fill it with a number of tds equal to number of cells with rowspan.
I just had a similar problem, try adding an empty Row at the end of the missbehaving Row something like this:
<table class="table table-bordered">
<tbody>
<tr class="warning" >
<td rowspan="2" >100</td>
<td rowspan="2">87</td>
<td rowspan="2">FERNANDO RODRIGUEZ</td>
<td rowspan="2"></td>
<td rowspan="2">MARIANO ORTEGA SANCHEZ</td>
<td rowspan="2" > </td>
<td rowspan="2" > </td>
<td rowspan="2">
<span class="label label-info">
Importacion
Sencillo
</span>
</td>
<td rowspan="2"> Monterrey </td>
<td rowspan="2" ></td>
<td rowspan="2" ></td>
<td rowspan="2" ></td>
<td rowspan="2">
<a href="/TimsaLzc/web/app_dev.php/main/fleteDetalle/100" >
<button class="btn btn-success">Detalles</button>
</a>
</td>
</tr>
<tr /> <!--magic goes here-->
<tr class="warning" >
<td rowspan="2" >101</td>
<td rowspan="2">82</td>
<td rowspan="2">IVAN CORTES</td>
<td rowspan="2"></td>
<td rowspan="2">MARIANO ORTEGA SANCHEZ</td>
<td rowspan="2" > </td>
<td rowspan="2" > </td>
<td rowspan="2">
<span class="label label-info">
Importacion
Sencillo
</span>
</td>
<td rowspan="2"> Nissan Mexico </td>
<td rowspan="2" ></td>
<td rowspan="2" ></td>
<td rowspan="2" ></td>
<td rowspan="2">
<a href="/TimsaLzc/web/app_dev.php/main/fleteDetalle/101" >
<button class="btn btn-success">Detalles</button>
</a>
</td>
</tr>
<tr /> <!--magic goes here-->
</tbody>
</table>
It worked for me :)