Sublime Forum

Advanced Search/Replace - includes one word but not another

#1

Hi - I need to search my code for all files that have the word “Login” in it but don’t have the word “noindex” in it.

And then for all files which match do a find and replace where I will add a meta tag for noindex. I can easily do a find and replace to add the metatag but don’t know how to do the search for files that have one keyword in it but not another.

0 Likes

#2

This feels like a job for a script TBH. You might be able to pull it off with a single search directly from Sublime, but without giving some context to help understand the structure of the file and where we might find these two words in relation to each other, it’s tough to tell.

0 Likes

#3

Thanks. I’ll probably either do it manually or write a script to search all the files individually. I think a script could definitely work.

The general structure is I have a folder called classes. In that folder is a bunch of php files which basically generate HTML. I’ve done an advanced search in these files with Sublime for the word “Login” and every file that is returned are the files I want to fix.

It looks like my question had the html stripped out so the question is a little confusing. Basically if the word noindex is not in the file, that means the metatag for no index is not in the file and I want the metatag for noindex added.

I’ll do this through a script

0 Likes