Home » Forum
NoNumber!

Joomla!® Websites & Extensions
development  -  support  -  consultancy

I try to respond within 48 hours (excluding weekends).
If I haven't responded by then, feel free to post a reminder or bug me via email.

My last reply was: 16 Hours, 43 Minutes ago.

Welcome, Guest
Please Login or Register.    Lost Password?

Replace code in div classs
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Replace code in div classs
#8315
Replace code in div classs 1 Year, 10 Months ago  
I have no clue how to set up regular expressions i search the we but very much still confused.

i have a multi line div class look somewhat like this.

<div class="bg-opaque pad-16 article">
text
s sadjs sa'ooak

<div>

dsfkdfkdof[dfp
;fds'flds'lf
</div>
</div>
I need a regular expresion that i will detect the first div class called bg-opague and replace it and all the text within it with the text i specify.

all help is much appreciated
Mr.show
Posts: 6
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#8316
Re: Replace code in div classs 1 Year, 10 Months ago  
If the div can also have nested other divs, it could be a little difficult.
So could the content also be:
<div class="bg-opaque pad-16 article">
...
<div>...<div>...</div>...</div>
...
</div>
Peter van Westen
Admin
Posts: 9165
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#8317
Re: Replace code in div classs 1 Year, 10 Months ago  
This will match up to two nested divs:
<div class="bg-opaque pad-16 article">(?:<div[^>]*>(?:<div[^>]*>.*?</div>|.)*?</div>|.)*?</div>


See here for more info:
badassery.blogspot.com/2006/03/regex-rec...thout-balancing.html
Peter van Westen
Admin
Posts: 9165
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#8326
Re:Replace code in div classs 1 Year, 10 Months ago  
ok i see i am going to need to give exact details on the format of the code as it has to be accurate so here it is any help is appreciated.

<div class="bg-opaque pad-16 article">
<div class="mod-article-title">
<div class="subhead"><span class="page-actions"> <!--     .page-actions li {display:inline;float:left;line-height:17px;padding:0 4px 0 0;}     .page-actions ul {float:right;padding-top:4px;width:auto;_width:413px;}          .page-actions a.count_bubble { background:url("http://a1.espncdn.com/prod/assets/count_bubble_right.png") no-repeat scroll right top transparent; color:#225FB2; display:block; float:left; margin-right:0px; margin-top:-4px; _margin-top:0px; min-width:25px; padding:0; text-align:center; } .page-actions a.count_bubble span { background:url("http://a2.espncdn.com/prod/assets/count_bubble_left.png") no-repeat scroll left top transparent; display:block; font-family:Helvetica,Arial,sans-serif; font-size:10px; line-height:16px; padding:5px 4px 11px 6px; _padding:2px 4px 11px 6px; } div.topsy_theme_blue a.topsy-sm-total {margin-left:1px;} div.topsy_theme_blue a.topsy-sm-retweet {margin-left:0;} .page-actions { padding:0; display:block; width:100%; } div.subhead cite.source {_width:162px;} .notebook-container .mod-page-header .page-actions a.count_bubble {color:#225FB2;padding:0 0 4px 0;} .mod-article-title .page-actions cite.source a {margin:0;padding:0;} .notebook-container .mod-page-header .page-actions {width:auto;} div.topsy_theme_blue a.topsy-sm-retweet:link, div.topsy_theme_blue a.topsy-sm-retweet:visited  {_background:#336699 !important;} #tweetmeme_button a.count { color:#424242; display:block; float:left; font-size:14px; font-weight:bold; margin-left:5px; margin-right:5px; padding-left:0; } #tweetmeme_button .retweet:hover, #tweetmeme_button .retweet.selected { background-position:0 -61px; color:#80B62A; } #tweetmeme_button .retweet { background: url('/"http://zulu.tweetmeme.com/widget.gif"') no-repeat scroll 0 -45px transparent; color:#FFFFFF; cursor:pointer; display:block; float:left; font-size:11px; height:16px; line-height:16px; padding:0; text-align:center; text-decoration:none; width:50px; } #tweetmeme_button a { border:medium none; text-decoration:none; } #tweetmeme_button { font-family:arial; } -->
<ul>
<li><a class="email" href="#" onclick="openWin=window.open('http://sendtofriend.espn.go.com/sendtofriend/SendToFriend?URL=http://sports.espn.go.com/chicago/nba/news/story?id=5049995&amp;title=Bulls\'%20Hinrich,%20Noah%20in%20starting%20five;%20Deng%20back&amp; id=5049995','sendtofriend','noresizable,noscrollbars,width=400,height=500');return false;">Email</a></li>
<li><a class="print" href="http://sports.espn.go.com/espn/print?id=5049995&amp;type=story" rel="nofollow">Print</a></li>
<li> <a href="http://myespn.go.com/s/conversations/show/story/5049995">Comments</a> <a class="count_bubble" href="http://myespn.go.com/s/conversations/show/story/5049995"><span id="comments-on-story-count"> </span></a> </li>
<li><a name="fb_share" href="http://www.facebook.com/sharer.php">Share</a></li>
<!--li style="vertical-align:bottom;"><mce:script type="text/javascript" mce_src="http://cdn.topsy.com/topsy.js?init=topsyWidgetCreator"></mce:script>
<div class="topsy_widget_data"--><!--{"url":"http://sports.espn.go.com/chicago/nba/news/story?id=5049995","title": "Bulls' Hinrich, Noah to start"}--><!--/div></li-->
<li> </li>
</ul>
<cite class="source"> By Nick Friedell<br />ESPNChicago.com<br /><a href="http://search.espn.go.com/nick-friedell/">Archive</a> </cite> </span></div>
</div>
<!-- begin story body --> <!-- template inline -->
Mr.show
Posts: 6
User OfflineClick here to see the profile of this user
Last Edit: 2010/04/04 16:56 By peter.
The administrator has disabled public write access.
 
#8328
Re:Replace code in div classs 1 Year, 10 Months ago  
Well, pretty hard to match all that via RegEx.

Does the html after the div have something unique it always begins with?
<!-- begin story body --> ???
Peter van Westen
Admin
Posts: 9165
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#8329
Re:Replace code in div classs 1 Year, 10 Months ago  
no it does not but if i could just get rid of this i would be more than happy that is the lines of code that i have the issue with

<li><a class="email" href="#" onclick="openWin=window.open('http://sendtofriend.espn.go.com/sendtofriend/SendToFriend?URL=http://sports.espn.go.com/chicago/nba/news/story?id=5049995&amp;title=Bulls\'%20Hinrich,%20Noah%20in%20starting%20five;%20Deng%20back&amp; id=5049995','sendtofriend','noresizable,noscrollbars,width=400,height=500');return false;">Email</a></li>
<li><a class="print" href="http://sports.espn.go.com/espn/print?id=5049995&amp;type=story" rel="nofollow">Print</a></li>
<li> <a href="http://myespn.go.com/s/conversations/show/story/5049995">Comments</a> <a class="count_bubble" href="http://myespn.go.com/s/conversations/show/story/5049995"><span id="comments-on-story-count"> </span></a> </li>
<li><a name="fb_share" href="http://www.facebook.com/sharer.php">Share</a></li>
<!--li style="vertical-align:bottom;"><mce:script type="text/javascript" mce_src="http://cdn.topsy.com/topsy.js?init=topsyWidgetCreator"></mce:script>
<div class="topsy_widget_data"--><!--{"url":"http://sports.espn.go.com/chicago/nba/news/story?id=5049995","title": "Bulls' Hinrich, Noah to start"}--><!--/div></li-->
<li> </li>
Mr.show
Posts: 6
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#8330
Re:Replace code in div classs 1 Year, 10 Months ago  
If the div always has the kind of content you gave, this should remove the entire div:
Search:
<div class="bg-opaque pad-16 article">.*?<cite class="source">.*?</cite>.*?</div>.*?</div>.*?</div>
Peter van Westen
Admin
Posts: 9165
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#8331
Re:Replace code in div classs 1 Year, 10 Months ago  
how do i know if this is working added it to rereplacer but nothing happens still see it on frontend
Mr.show
Posts: 6
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#8332
Re:Replace code in div classs 1 Year, 10 Months ago  
Can you give me admin access?
Peter van Westen
Admin
Posts: 9165
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#8333
Re:Replace code in div classs 1 Year, 10 Months ago  
i sent the info using you contact form
Mr.show
Posts: 6
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#8335
Re:Replace code in div classs 1 Year, 10 Months ago  
I think I got it up and running how you want...
Peter van Westen
Admin
Posts: 9165
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#8337
Re:Replace code in div classs 1 Year, 10 Months ago  
i notice thanks you much i just figured out a few things with regexbuddy software i downloaded time for me to donate because you did more then i expected thank you very much.
Mr.show
Posts: 6
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: Peter van Westen
Open Source Training | Online Joomla! Training and Support
MaxCDN | Content Delivery Network | Accelerate your site to the max
hosting joomla