rogershen / chrome-regex-search

Other
272 stars 56 forks source link

code formatting seems to break the extension #52

Open RedMoikle opened 3 years ago

RedMoikle commented 3 years ago

I am trying to search for for loops in some python code examples for a module.

I can see one on the screen so I know where it should be highlighted. in the search bar I use: for\s\w+\sin to search for "for" followed by a whitespace character, then any variable name, followed by another whitespace character and finally the word "in"

This formula works for text on the page that is not formatted as code, but not if it is in a code block. image

The extension CAN find single words in code blocks, if I search for just "for" it manages to find them in code blocks (as well as outside of them)

in fact white space in code formatting seems to completely block this extension (even when using .* to select ALL characters following the searched string): image

Here I have searched for all examples of the characters "de" and then everything that follows them. as you can see, the white space in the code blocks ends this search.

Interestingly there is no issue with chrome's standard Ctrl+F function, that can find full sentences inside of code blocks.

RedMoikle commented 3 years ago

After some more testing, this seems to be because it is reading spans separately, and parts of the code are in separate spans to have keywords highlighted in different colours. Would it be possible to have an option to ignore html tags, listing only their contents, and maybe concatenating them (like chrome's default ctrl+f does)?