Improve single file find (search) by adding selection, casing, whole-word, regexp

It would be nice if the local (single) file search was improved to support:

  • selection: search only in selected text
  • word case: sensitive or insensitive
  • whole word match or not
  • regexp: …

Some of these are currently covered by plugins.

24 Likes

@WhiteNoise, I don’t know why your change in ‘technique’ as a Mod from simply responding to posts to also suggesting feature requests, but I for one sure do appreciate it. Gives me a chance to Like the suggestion/idea and then Watch for how others respond. Keep it up.:wink:

1 Like

I’d be shocked if this wasn’t requested somewhere, but if it has been, I can’t find it.

Use case or problem

I need to search and replace on a case-sensitive basis. I need to replace “his” with “my” and “His” with “My.”

Proposed solution

Add a checkbox that allows to find & replace dialog to opt in to case-sensitive search.

Current workaround (optional)

At the moment, I search for lowercase and then manually replace when it finds the uppercase version.

5 Likes

I am also surprised no-one seems to miss this. I just had to fix up a note, where the character encoding has been messed up, somehow. The only way was to manually search and replace each crumbled word. However, sometimes the words are beginning a sentence and start upper case. Just to mention a use-case…

A big +1 from my side. In the meantime:
For a hacky workaround see here.
@wmbenedetto: I know it’s a bit late, but there is a plugin called “Regex Find/Replace” that uses case sensitive search by default.

2 Likes

If I hit Cmd + F within a note, this pops up:

It doesn’t let you search within the current note case-sensitively. Can we add a “Match case” toggle to this search dialog?

This is particularly useful for Find and Replace, which I often do within a note. I usually need to match exactly by case to be able to Replace All quickly.

Edit: Originally posted here, Case sensitive note search. Moved here as duplicate.

+1 to this feature.

It also be great if it shows how many matched results in search. I need that for my Thesaurus file to see if I have duplicated words.

Original topic for show number of matches in Cmd + F

I don’t understand why this basic feature hasn’t been added since the first versions? For both search and replace, such functionality is a must. Third-party plugins can certainly be used, but they don’t have the same visual flexibility and apply to all text at once.

Whole word search doesn’t work at all for me.

Quotes don’t work. See below, I’ve photoshopped a few examples together.

1 Like

Huh… I was convinced that such barethread search functionality had to be caused by something gone wrong in my installation.
Good to see my installation is OK, bad to see that this is all there is :grimacing:

This seems to be a problem that plagues me periodically but unceasingly. Every couple of months, I do a big online search, don’t really find anything, and either fenangle something to get the job done (e.g. using file managers) or just forget it.

A syntax that works in some cases is add spaces and then quotation marks around the word.
" his" should block “this” from showing, but won’t block “history” or whatever useless result. " his " should give you that exact word, but not if there’s a full-stop trailing it.

sadface

Use case or problem

I’m looking for a specific word with casing, e.g. “AI” instead of “ai” or “Tails” (the character name) instead of “tails” (the common word plural).

Currently, searching “AI” will match “ai” inside the word “pair” and “Tails”. Searching “Tails” will find both “Tails” and “tails”, as well as other composites like “entails”.

Proposed solution

Add a checkbox “Match case” to the Search current file (Ctrl+F) toolbar, similarly to other text editing apps.

Note that Ctrl+Shift+F (Search in all files) already has this feature: in fact, you can either toggle the “Aa” match case button, or use the special syntax: match-case:[word]. We just need this for simple file search.

For short words like “AI”, the issue may also be solved by adding a “full word” or “word boundaries” option/syntax that makes sure you only match full words equal to “AI” and not containing the string “AI”. This would still match “ai” (rare, maybe love in Japanese), “Ai” (possible Japanese name) and “iA” (unlikely) but not “pair” and “Tails”. However, that would be another feature request.

Current workaround (optional)

I can use Ctrl+Shift+F to search all files and use either “Aa” match case button or match-case:[word]. However, I then need to pick the correct file in the list.

There may be a plugin that does this, but I’d rather keep using native search for such a simple operation.

Related feature requests (optional)

There is How to make Search Case Insensitive? which gives you the impression this was implemented, however the users are talking about Ctrl+Shift+F to Search in all files (by the way, the thread title should be renamed to reflect that; it’s disturbing for new users). The topic is closed so I cannot comment nor backlink to this issue.

9 Likes

You can extend your workaround by adding a file: search operator with the name of the note you want to search in. https://help.obsidian.md/Plugins/Search#Search+operators

3 Likes

+1 I use this frequently in applications that support it.

+1
Important when perusing long documents.

+1 This would be very nice to have.

+1 for this feature!

I am often needing this. Hope it gets added soon.

+1 This would speed up looking through code. I currently copy it to another editor to search with case sensitivity, then move it back to Obsidian.