Skip to main content
Known Participant
June 10, 2019
Answered

Reg Ex wildcard help please

  • June 10, 2019
  • 5 replies
  • 972 views

I have many, many strings of html code in Dreamweaver, scattered all through the document, such as:

<a href="file:///C:/Users/User/AppData/Article-final-draftdocx#_edn4" name="_ednref4">[4]</a>

<a href="file:///C:/Users/User/AppData/Article-final-draftdocx#_edn5" name="_ednref5">[5]</a>

<a href="file:///C:/Users/User/AppData/Article-final-draftdocx#_edn6" name="_ednref6">[6]</a>

<a href="file:///C:/Users/User/AppData/Article-final-draftdocx#_edn7" name="_ednref7">[7]</a>


My first step is simply to find all occurrences of lines that match that pattern.   I'm trying to use wildcards to construct this search:

Find each occurrence of a string that BEGINS with <a href="file:///C:/Users   and ENDS with   ]</a>

So if it finds:
<a href="file:///C:/Users/User/AppData/Article-final-draftdocx#_edn4" name="_ednref4">[4]</a> 

Then I can click FIND NEXT and it will then find

<a href="file:///C:/Users/User/AppData/Article-final-draftdocx#_edn5" name="_ednref5">[5]</a>

etc etc

I'm stuck with my syntax, and would appreciate any advice.

This topic has been closed for replies.
Correct answer WolfShade

Alternatively, you could use:

<a href="file:[^"]+" name="[^"]+">(\[[\w\d]+\])</a>

V/r,

^ _ ^

5 replies

ThomasLLLAuthor
Known Participant
June 14, 2019

Thank you, but no.   The FIND string was yielding zero finds.   I do indeed have the RegEx box checked, and confined the search to the current doc only.

WolfShade
Legend
June 14, 2019

Okay.. let me open DW and tweak it a bit.. I'll post it as soon as I have it.

V/r,

^ _ ^

ThomasLLLAuthor
Known Participant
June 14, 2019

Thank you , Nancy.  I misunderstood what you were advising, and it worked great!

The only thing about finding that string and then manually editing one by one is that there are so many !

On a string like this, I need to FIND this pattern <a href="file:///C:/Users/User/AppData/Article-final-draftdocx#_edn6" name="_ednref6">[6]</a>

And REPLACE it with replace it with just [6].   (only keep the red characters in the line above).

That's why I was thinking of RegEx originally.

WolfShade
Legend
June 14, 2019

Ah!  Details are important.  I did not see that in your original post.  So, let me understand.  You are attempting to do a mass find/replace where you are completely removing the anchor tag and leaving only the text between opening and closing anchor tags?

V/r,

^ _ ^

ThomasLLLAuthor
Known Participant
June 14, 2019

LOL, yes the details woulda been nice.  I realize my original question was worded unclearly.

You have understood it correctly, and you worded it much better than me!    Yes, the goal is to remove the anchor tags but retain the text.

(the text, in every case, will be bracket-number-bracket)

ThomasLLLAuthor
Known Participant
June 13, 2019

Thank you, but my question has nothing to do with my C drive.   I certainly know how CTRL-F works. I'm asking for Reg Ex help.

I have a large html file with many strings in it like the ones I posted above, scattered through.   I need help with  Reg Ex search for this query:

Find every instance of a phrase beginning with <a href="file:///C:/Users/User/AppData/Article-final-draftdocx# 

and

ending with ]</a>

Such a Reg Ex search will find all the lines I need to find, no matter what number is included in those lines.

<a href="file:///C:/Users/User/AppData/Article-final-draftdocx#_edn6" name="_ednref6">[6]</a>

<a href="file:///C:/Users/User/AppData/Article-final-draftdocx#_edn22 name="_ednref22">[22]</a>

<a href="file:///C:/Users/User/AppData/Article-final-draftdocx#_edn437 name="_ednref437">[437]</a>

etc etc etc

Nancy OShea
Community Expert
Community Expert
June 13, 2019

This is simple stuff. You don't need Reg Ex to find all stings containing file:///C:/ (whatever...) in DW.  Do what I suggested and you'll find them all in your results panel.  Try it and see for yourself.

Nancy O'Shea— Product User & Community Expert
Nancy OShea
Community Expert
Community Expert
June 10, 2019

To perform a search of your current document or your entire current local site, use Ctrl + Shift + F (Find).  See screenshot.  Hit Find All.   Your Results Panel will show a list.  Double click each item in the list to open the code.

Nancy O'Shea— Product User & Community Expert
Nancy OShea
Community Expert
Community Expert
June 10, 2019

You understand that any and all references to file:///C:/Users/.... are pointing to files on your local hard drive that nobody can access except you.  Start by defining your local site folder.   Site > New Site >  enter the site folder name.  For example, C:\MyTestSite.

File > Save All.

Nancy O'Shea— Product User & Community Expert
ThomasLLLAuthor
Known Participant
June 10, 2019

Yes, thank you.    That's why I want to find those strings so I can replace each one with the correct one.