Just tried searching for a keyword in an XSLT file and it returned no results, despite highlighting the word about a dozen times in the file anyway.
Visual Studio clearly thinks the word cannot be found in the file, yet to the left you can see it's also highlighted matching text. "Find" and "Find All" return the same results. I haven't made any changes to my settings, so I don't know where to go prodding for search options to see if something's been changed by company policy or some other similarly daft reason.
I think you might be running up against a slight anomaly in the Quick Find functionality. When you first select Quick Find, if you have text selected in the editor window, the selected text appears as the search phrase and all instances are highlighted. But if you turn on a filter (such as Case Sensitive or Whole Word), some (possibly all) of the highlighted text instances no longer match the search string.
Try this:
Highlight a word in your code.
Click Find and Replace > Quick Find. All instances of the word are highlighted.
Now turn on Match Case, and change one letter in the search box so it is a capital letter.
Click Find. All instances of the word remain highlighted, but the "No results" dialog appears.
The problem is compounded by the fact that the little filter icons in the Quick Find window are difficult to interpret.
Related
I am in Delphi 10.2.2 Tokyo and trying to do a simple regular expression search. I'm sure I've done this before but it's not working.
It doesn't work whether I Ctrl-F search in the current source file or I Ctrl-Shift-F Find in Files.
I have researched this to make sure I understood the special characters & their meanings.
Anyway, search string fun.*e I assume will find any function declaration with an e in its name.
It finds nothing! I have tried a variety of searches like this - they all are finding nothing.
Case sensitive unchecked.
Whole words unchecked.
Search selection unchecked.
Entire scope checked. (for Ctrl-F, in current source file, search)
And, of course, Regular expression checked.
If I Search in Files I get the Search string 'fun.*e' not found popup. Period.
However, if I Ctrl-F I am seeing (current unit) 31 matches found in dark green down in the "search bar" and if I scroll through the unit, I am seeing the matches (highlighted in orange). But the cursor does not move to the first (or any) match. If I hit F3 immediately after doing the search (and seeing 31 matches found) I am getting the Search Match Not Found Restart search from the beginning of the file? popup. And if I say Yes I am back to seeing Search string 'fun.*e' not found!
I don't know if I might've changed some setting or option or whatever. I cannot imagine that I have. But I need to use Regular Expressions for searching.
FWIW, "normal" searches are working fine (whether Regular expression is checked or not).
I had Tools | Options | Editor Options | BRIEF regular expressions on.
Turning this off has fixed my issue.
This probably isn't a VS Code-specific question but it's my tool of choice.
I have a log file with a lot of lines containing the following:
Company.Environment.Security.RightsBased.Policies.RightsUserAuthorizationPolicy
Those are debug-level log records that clutter the file I'm trying to process. I'm looking to remove the lines with that content.
I've looked into Regex but, unlike removing a blank line where you have the whole content in the search criteria (making find/replace easy), here I need to match from line break to line break on some criteria between the two, I think...
What are your thoughts on how criteria like that would work?
If the criteria is a particular string and you don't want to have to remember regexes, there is a few handy keyboard shortcuts that can help you out. I'm going to assume you're on a Mac.
Cmd-F to open find.
Paste your string.
Opt-Enter to select all of the instances of the string on the page.
Cmd-L to broaden the selection to the entire line of each instance on the page.
Delete/Backspace to remove those lines.
I think you should be able to just search for ^.*CONTENT.*$\n, where the content is the text you showed us. That is, search on the following pattern:
^.*Company\.Environment\.Security\.RightsBased\.Policies\.RightsUserAuthorizationPolicy.*$\n
And then just replace with empty string.
I have already up-voted answer of #james. But.. still I found one more easy and many feature available extension in VS Code. Here it is
It have much easy options to apply filters.
To match specific case mentioned in question. I am attaching screenshot which display how to use for it. I am posting this for others who come here in search for same issue. (Like I came)
Just now I was working on a fancy search and replace regular expression.
It looked good so I tested it on one entry then went to the editing area and the search and replace box went away.
I reopened the search and replace box to continue, but the selected text in the edit window replaced my search expression.
Control Z in the search box did not go back to my regex but undid the last change in the editing area.
I can't seem to find a way to get back to previous regexes in the find box. Is there any way? Googling turned up nothing.
Currently, Adobe Brackets doesn't maintain any kind of history of search and replace expressions. The feature is still missing.
I've just started to get to grips with regex in notepad++ and I've tasked myself with formatting a chunk of JSON data into something human readable, as well as something that can be read into an algorithm a colleague of mine wrote. I've found a few regex expressions that do this perfectly, but in order to get to my desired result, I have to do it in four separate Find/Replace steps. Is there some sort of way I can create one single find/replace expression that handles all of the above tasks for me?
Currently I have Notepad++ doing the following:
Deleting all quotation marks by finding " and replacing it with
nothing
Deleting all commas by finding , and replacing it with nothing
Changing all underscored numbers that are followed by a colon with
the number 0 (the reason behind this is particular to the project)
by finding _[0-9]*: and replacing with _0 and finally, putting all
of a particular expression onto it's own line by finding the start
of the particular string I'm after and adding \n.
I know that's convoluted, but fortunately it does the job. Is there any way of consolidating all that into a single command, or does that all have to be done step by step?
Thanks guys :)
Notepad ++ allows you to consolidate individual search and replaces as a macro which you can also save.
Hit the record button in the toolbar (or Macro>Start Recording)
perform these regex replacements in the required order.
hit stop button in toolbar (or Macro>Stop Recording)
Hit the play button to perform all the required replacement operations again.
Save the macro by going into the Macro option in the window menu and 'save current recorded macro'
As for the first to replacements you could use the following expression: (?:"|,)
I have these words: TOP and LOCK. I have 49 times this word but I would like to replace it with a different word a lot of times. For example, the first time with luc and the second times with pile.
I would like to make it automatically. I have the list of the replace words in a text file. I use Notepad++.
I have searched on many sites, but cannot find a good solution.
I don't have notepad ++ but can you highlight and right click there's an option to replace? or highlighting it then clicking format at the top and clicking replace and finally using Ctrl + F and replacing it that way? sorry if i could not help :)
try this:
tap ctrl + F
you can look at this pisture to get the picture:
http://im34.gulfup.com/Vkws5.jpg
Hope it help you
Highlight TOP
Press Search on top menu bar
Go to Replace
Under Find What, in Replace with field type what you want to replace it with
Then hit Replace All
You will then see the changes
I'm not very familiar with Notepad++ but I can do this with Sublime Text. I guess it doesn't hurt for you to try it out.
First, select all the words you want to replace with multiple cursor mode. Basically you can find TOP|LOCK with regular expressions, and hit Alt+Enter to convert the found words to multiple cursors.
Second, copy the words you want to replace and use the Text Pastry plugin to paste them in, one word at each cursor.
See here for a demo: http://imgur.com/a/KrBB8#0