Solved

Pattern Matching LF in Dreamwever CS5

Posted on 2014-02-20
2
272 Views
Last Modified: 2014-02-20
I need to remove some <b> tags around href tags.  I have some href lines that span more than one line so my pattern isn't matching when it hits the LF character.

<p><b>  <a href="http://www.thefrugallife.com/auto_lease.html">Getting Out of an Auto *** this is where the LF is **************
  Lease</a></b></p>

Open in new window


Here is my code the regex flavor is Javascript (MSIE standard)

<b>([\s|\r\n]+)?<a href="(.+)?.html">(.+)?</a>([\s|\r\n]+)?</b>

Open in new window


Please help me figure this out.

Thanks,

Randal
0
Comment
Question by:sharingsunshine
2 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 39875559
At the very end of the regex you have:

</a>([\s|\r\n]+)?</b>

Open in new window


Match the closing </a>, followed by one or more whitespaces or linebreaks one time followed by the closing </b> tag.

The source code has:

this is where the LF is **************
  Lease</a>

Open in new window


The line break occurs before the </a>, not after. So no match.

<b>([\s|\r\n]+)?<a href="(.+)?.html">(.+)?([\s|\r\n]+)?(.+)</a></b>

Open in new window


Should work.
0
 

Author Closing Comment

by:sharingsunshine
ID: 39875721
Absolutely correct, I can't believe I didn't see that, but I am glad you did.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

As most anyone who uses or has come across them can attest to, regular expressions (regex) are a complicated bit of magic. Packed so succinctly within their cryptic syntax lies a great deal of power. It's not the "take over the world" kind of power,…
In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now