Skip to main content
Okoth1
Inspiring
Sep 20, 2022 10:22 AM UTC
Answered

Find html files that don't contain certain string

I'm looking for a way to go through a folder with HTML files and list the files that are missing a certain string. Is there a way to do this with Dreamweaver 21.2 in Windows 10?

 

Thanks

 

 

 

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Okoth1
    Okoth1Correct answer
    Inspiring
    Sep 20, 2022 10:19 PM UTC

    I went ahead and found a solution Visual Studio Code. There is an extension called "Reverse Search". Got the list.

    Thanks for your replies anyway.

    6 replies

    Okoth1
    Okoth1AuthorCorrect answer
    Inspiring
    Sep 20, 2022 10:19 PM UTC

    I went ahead and found a solution Visual Studio Code. There is an extension called "Reverse Search". Got the list.

    Thanks for your replies anyway.

    Translate
    Nancy OShea
    Community Expert
    Community Expert
    Sep 20, 2022 6:44 PM UTC

    I'm RegEx challenged.  Whenever possible, I use Advanced Find & Replace with tags and attributes.   Will that work for you?

     

     

     

    Translate
    Nancy O'Shea— Product User & Community Expert
    Okoth1
    Okoth1Author
    Inspiring
    Sep 20, 2022 10:12 PM UTC

    I'm all in for it, but how can I find the files that don't contain a string using the Advanced Find?

    When I use in Advanced: Not Containing --> Text --> script src, as a result, I get every line that is in those 397 documents. Including the script lines.

    Translate
    Jon Fritz
    Community Expert
    Community Expert
    Sep 20, 2022 12:38 PM UTC

    Depending on what you're looking for a Regular Expression like the following may work...

    ^((?!the specific text here).)*$

    1. Open the Find & Replace in Files window (Ctrl + Shift + F)
    2. Click the Basic tab
    3. Click the martini glass icon (Filter)
    4. Check Use Regular Expression
    5. In the Find In field, paste...
         ^((?!the specific text here).)*$
    ...and replace the bold part with the text you want to exclude
    6. Make sure "Entire Current Local Site" is selected for the "In" field and leave [any tag] selected

    7. Click Find All
    8. In the Search Window that comes up, you will get a list of pages that don't include your text, double click them to open them from the list

    [Moderator Note: Color added for clarity]

    Translate
    Okoth1
    Okoth1Author
    Inspiring
    Sep 20, 2022 10:03 PM UTC

    If I do exactly what you say and use the regular expression ^((?!<script src).)*$ I get Not Found in 397 documents.
    I assume the question and exclamation marks are not bold (hard to see on my screen).

    Translate
    Jon Fritz
    Community Expert
    Community Expert
    Sep 21, 2022 12:31 PM UTC

    The search you give works perfectly here, same version of DW, same OS.

    Did you check the box for Use Regular Expression (step 3-4 above)?

    Without that checkmark in place, the search string doesn't run.

    Translate