Skip navigation
Currently Being Moderated

DW CS5 - Find/Replace using RegEx

Jun 13, 2012 12:45 PM

Hello, everyone.

 

I am working on some inherited code, and the previous people used some named anchors; some are properly closed, most are not.  There are over 100 of them that I don't want to correct manually.

 

Examples:

<a name="this">

<a name="that"></a>

<a name="other">

<a name="org"> </a> <-- notice the space between

 

I am trying to use RegEx in the Find and Replace so I can correct these to all being closed.  Here is the string I'm looking for:

 

 

<a name="([^"]*)["]>[^\w{1,}<\/a>]

 

But this is not finding any of the named anchors.  I did have the same thing, minus the [^\w{1,}<\/a> part, but it found ALL the named anchors, closed and not-closed.

 

Also, I have (for replacement) <a name="$1"/>, but am not sure if this will properly replace.  Suggestions?

 

^_^

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points