Is there a search operator for search within nested block?

Hello everyone! I need help!

What I’m trying to do

I am trying to make specific search only within nested block (paragraph) in a note. For example only in A, B, C & D from the picture. Is there an operator for it?

Things I have tried

I have tried line, block and section but not what I am looking for. There is a work around with section but it will involve using heading too much for my liking.

Thanks in advance for your help!

1 Like

There isn’t. You could use a regular expression:/\t+.*test/

This should match 1 or more tabs followed by 0 or more characters followed by the search term “test”. If you want a specific level of indentation, remove the + and use a \t for each level. If you use spaces instead of tabs, replace each \t with the appropriate number of spaces.

There’s a way to make it match only the search term by using a “lookbehind assertion” but I forget the syntax. It might be /(<=\t+.*)test/

1 Like

Thanks. The syntax looks like a code from programming language :smile:

They are programming-y (and often gnarly). :smile: Regular expression - Wikipedia

1 Like

I think /\t*/ would be better than /\t+/. The former matches 0 or more tab, the later matches 1 or more tab.

And for searching(matching) the content within the bullet list, one can use/\t*-\s.*test.*/, which contains these parts:\t*, -, \s, .*test.* and will match the line looks like the following:

- abctest123
	-abctest

And for the numbered list, one can use
\t*\d+\.\s.*test.*

Blockquotec

They want to find indented text, so there should be at least 1 tab. Otherwise there’s no reason to mention the tabs in the search.

Oh, I see. So the search is about to find the text under curtain level of the list.
Yea, you are right. In that case, there should be more than 1 indent.

Hi, I need your help again. What would be the expression when I need to find two words (obsidian notion) instead of “test”. Order is not specific.

line:(/\t/ notion obsidian)

It should match both words and a tab together in the same line. (The tab is written as a tiny regular expression because as far as I know it’s the only way to search for one here.)

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