Search operator for two unconnected phrases

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

"

Find only notes that contain both Phrase 1 and Phrase 2. There are many words between the two phrases.

Things I have tried

“”“Phrase 2"“Phrase”” That is quotes within quotes. That did not bring up any notes. I need a different search operator?

I looked for online showing me basic Boolean operators. Only quotes applied to find one phrase.

This is what regex is good for. It is what proximity or range search is called elsewhere.
Type in search:
/phrase1.*?phrase2

  • This will find the closest occurrence of one and the other and if there are two or more results, every single result will be highlighted in the search pane (if any). / means Obsidian expects a regular expression.

/phrase1.*phrase2 will find phrase1 and the last instance of phrase2 within the note (if any).

The first type of search makes much more sense, usually and I advise people use that (don’t forget the question mark after the dot and asterisk).

If there is a space in either of the phrases, use \s for space. E.g.:
/phrase\sone.*?phrase\stwo.

Enclose each phrase in double quotes. There is an implied AND , so this search finds all notes containing both “Phrase 1” and “Phrase 2”.

“of metacognition” “on linguistics”

You mentioned Regex and I looked up a tutorial. The language is out of my experience. So, I am very grateful for your help. For now, I will rely on rote coping and come back to the forum for specific help. It worked. Thank you

When I copy in /phrase1.*?phrase2 the astrisk becomes hidden. Also, these are hidden in my Obsidian note. I can't type out a single My Obsidan is set to make those double. I guess I begin my phrase in the middle of the ``

No need to learn regex for now.
Just remember to put one dot plus an asterisk plus a question mark between search terms and start with a normal slash for Obsidian to know these are not to be taken as literals.

Yes, that is why enclosing phrases inside double quotes does not work to reduce the number of notes that appear. I need that regex code that Gino_m showed me.

I do not understand the etiquette of putting an @ sign before a name. I was told that I should not put a @ before a core team member. I am just barely maneuvering around this complex site. How would I know who is core? Is it safe to put a @ before gino_m 's name?

Maybe I’m misunderstanding.

You mention: Find only notes that contain both Phrase 1 and Phrase 2.

The search query above does do that, it finds all notes with both phrases regardless of what is between them.

What am I missing?

In markdown a single asterisk makes the text after it italic and hence the asterisk will disappear.
You need to put your text in the search box not in the editor area where your note is.

Safe, I am soft core.:slight_smile:

1 Like

Hi Gino,
Thank you for your reply. I do not have this key on my Japanese keyboard.
On my computer, I can use a typing program to put in that character. But on mobile, I would have to look up your note and copy the key. Not very efficient for daily life.
Ellen Madono

The character you meant is /. You can easily install or set languages for keyboards on Android, iOS and your PC as well. I’m not familiar with Japanese keyboards but I’m guessing it should be there somewhere.

Thanks. I will try. You mean substituting one key that I do not use much for the key that I need.

I’m not sure I understand. But luckily, you understand, because we both speak English…
I took this off of the net:

There’ll be a similar result for how to add a language on iOS as well.

Am I being helpful here?

I need to use both Japanese and English. So, I am going to change a key. It is possible, but I will have to look for how. It has something to do with changing the keyboard, but just one key. Don’t spend time on this. I can just copy the key sign. Thank you for going to so much trouble.
Blessings,
Ellen

I write bilingually as well, mostly on Linux and Windows, and on iPadOS as well, rarely or never on Android.

In my Android days, I used the Google Keyboard for this and the Gboard app can be installed on iOS/iPadOS as well. One can write bilingually on it and it makes it easy to switch between languages as well. Not sure how it would work out with Japanese as it doesn’t use the Latin alphabet I reckon. One needs to add the language, though (and maybe set primary, secondary languages). Not difficult to set up at all.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.