Regex Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreRegex Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 16th, 2012, 03:31 AM
patrmich patrmich is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2012
Posts: 1 patrmich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 11 sec
Reputation Power: 0
Other - How to search and replace an expression by another when using Regex in Notepad++

Hi,

In a directory of html files, several files contain the following chain :
<li><font size="2">xxxxxxxxxx</font></li>
where xxxxxxxxxx is a chain which can vary from 10 to 100 characters
I would like to replace
<li><font size="2">xxxxxxxxxx</font></li>
by
<li>xxxxxxxxxx</li>

When using the Serach and Replace function of Notepād++, is there a way to make such replacemnt ?

Thank you in advance for any help in this matter.

Patrick

Reply With Quote
  #2  
Old March 17th, 2012, 12:00 AM
ragax's Avatar
ragax ragax is offline
Turn left at the third duck
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Location: Nelson, NZ
Posts: 93 ragax User rank is Second Lieutenant (5000 - 10000 Reputation Level)ragax User rank is Second Lieutenant (5000 - 10000 Reputation Level)ragax User rank is Second Lieutenant (5000 - 10000 Reputation Level)ragax User rank is Second Lieutenant (5000 - 10000 Reputation Level)ragax User rank is Second Lieutenant (5000 - 10000 Reputation Level)ragax User rank is Second Lieutenant (5000 - 10000 Reputation Level)ragax User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 24 m 37 sec
Reputation Power: 92
Hi patrmich,

I don't know about Notepad++ (I've heard that its regex capabilities are poor). In EditPadPro (which is regex-friendly) you can use this:

Search:
Code:
<li><font size="2">((.(?!/font))*)</font></li>

Replace:
Code:
<li>\1</li>

This uses a negative lookahead, which N++ may not support.

If you know for sure that there is not going to be another tag inside the font tag, then you can use something simpler that will work with a more primitive regex engine:
Search:
Code:
<li><font size="2">([^<]+)</font></li>

Replace:
Code:
<li>\1</li>


Please let us if one of those works.
__________________
Regex Tutorial | Latest RegexBuddy Demo

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreRegex Programming > Other - How to search and replace an expression by another when using Regex in Notepad++

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap