完了

Javascript code with regexp to find <img> inside a <p> and replace it

It should use regexp and pure javascript. No jQuery, no selectors, no DOM, etc.

I have a HTML content in a javascript string in the following format:

<p>text text text <img class="class1" alt="alt" src="http://..."> text2 text2 text2 <img class="class2" alt="alt2" src="http://..."></p>

<img class="class3" alt="alt" src="http://...">

<p>text3 text3 text3 <img class="class4" alt="alt" src="http://..."> text4 text4 text4 <img class="class5" alt="alt5" src="http://...">text</p>

I want a regexp which breaks the <p> tag when it find a <img> tag inside a <p>, basically replacing "<img>" by "</p><img><p>".

The script should also replace blank <p> tags, like "<p></p>";

The result should be:

<p>text text text </p>

<img class="class1" alt="alt" src="http://...">

<p>text2 text2 text2</p>

<img class="class2" alt="alt2" src="http://...">

<img class="class3" alt="alt" src="http://...">

<p>text3 text3 text3 </p>

<img class="class4" alt="alt" src="http://...">

<p>text4 text4 text4 </p>

<img class="class5" alt="alt5" src="http://...">

<p>text</p>

need it in like 1-2 hours.

スキル: Javascript, 正規表現

さらに表示: loke yew freelance http baby6969 blogspot my p j html m 1 puchong freelance http baby6969 blogspot my p puchong_1 html m 1 jln i, html head head body script type text javascript document location replace https www ubt esse3 u gov rash al auth studente appell, html head head body script type text javascript document location replace http m josemasanben store aptoide com app market com a, javascript, i need a logo designed for perú pool service and repair i am thinking that inside the letter p could be a pool and maybe the let, i need a logo designed for per pool service and repair i am thinking that inside the letter p could be a pool and maybe the lett, html call javascript img, clean html content javascript, html projects javascript validation, html cms javascript, html css javascript sql engineer programming karachi, user html form javascript, activate flash html ie7 javascript

採用者について:
( 15件のレビュー ) Sao Paulo, Brazil

プロジェクトID: #17399995

アワード:

vishnusaimamidi

hey buddy, i can do that ! i interned with an american company proace international shopping mall you can check my work sample here www.proaceintlshoppingmall.com. and [login to view URL] and other was angular js もっと

$10 USD 1日以内
(レビュー1件)
0.0

13人のフリーランサーが、このジョブに平均$24で入札しています

sergioes

Hi, so you want to remove the image tag from all p tags? Thanks. Sergio. ------------------------------

$25 USD 1日以内
(28件のレビュー)
5.6
$25 USD 1日以内
(20件のレビュー)
5.3
bengalTIGER1106

⭐⭐⭐⭐⭐⭐hello i can finish your project in 1-2hours⭐⭐⭐⭐⭐⭐ I am Expert with 4+years experience. This is my profile::https://www.freelancer.com/u/bengalTIGER1106 I read your requirements. I have a good skills for imple もっと

$50 USD 0日以内
(25件のレビュー)
5.3
bestit4u

Hi Nice to bid on your project My name is Shan Bin and I am a chinese developer I am expert on regular expresion Please hire me I can finish it in 1 hour thanks Shan Bin

$35 USD 1日以内
(11件のレビュー)
4.9
$16 USD 1日以内
(26件のレビュー)
3.7
mehroz1255

Hello , i am expert in javascript and can do this task ...........Message me i can do this now .......

$15 USD 1日以内
(5件のレビュー)
2.4
ramanbaghla

"i can start your work right now" hii there, i have gone through your complete project requirement and understood very well. please share the url of the website where you want to changes? please share the credentia もっと

$30 USD 1日以内
(レビュー1件)
1.7
$30 USD 1日以内
(3件のレビュー)
1.6
kcgzerone520

Hi, I can create the pure javascript code to extract the content. I will deliver the result in an hour. Let's get started Regards Alex

$25 USD 0日以内
(0件のレビュー)
0.0
vtechsolutionsof

HELLO Expert: JavaScript Developer/HTML/CSS 12+ year experience and expert JavaScript application developer with wide range of languages, tools, technologies, frameworks, patters for good solution to your requi もっと

$10 USD 0日以内
(レビュー1件)
0.0
netvision1976

Dear Prospect Hiring Manager. Thank you for giving me a chance to bid on your project. i am a serious bidder here and i have already worked on a similar project before and can deliver as u have mentioned I have もっと

$25 USD 1日以内
(0件のレビュー)
0.0
$10 USD 1日以内
(0件のレビュー)
0.0