stefankueng / grepWin

A powerful and fast search tool using regular expressions
https://tools.stefankueng.com/grepWin.html
GNU General Public License v3.0
1.74k stars 180 forks source link

Identations break in "Seach for" field #414

Closed pwnoobz closed 1 year ago

pwnoobz commented 1 year ago

Sometimes I want to copy a block of code and paste it in the "Search for" , but when the block of code has identations and starts a bit further from the start of the line it breaks in both "Search for" field and in "Replace with" fields.

Example:

                    <div class="some-class">
                        <div class="some-other-class">
                            <div class="another-class-here"></div>
                            <div class="another-class-here"></div>
                            <div class="another-class-here"></div>
                            <div class="another-class-here"></div>
                        </div>
                    </div>

Can you by any change improve on this?

Using the latest version on Windows 10 OS.

stefankueng commented 1 year ago

Sorry, but that's definitely not the job of grepWin. Think about it: how could grepWin even know that it can/should remove leading whitespaces? How could it know that you don't want the leading whitespaces (even though you "entered" them)?

daxliniere commented 1 year ago

I have a similar issue. I want to change this:

image

to this:

image

I've used the multiline editor for both (great feature, by the way!), but there are no search results. When I use only the first line, the search function is able to find all of the lines as expected. Is there a way to solve this?

(EDIT: I wasn't even able to paste the actual text here, Github changes the formatting even when using the code tags)

daxliniere commented 1 year ago

This is with all characters displayed. You can see that space characters are included not only between the words, but also several of them indicating indents.

image

stefankueng commented 1 year ago

@daxliniere when searching, use \s+ to search for whitespace with x indentation.

daxliniere commented 1 year ago

Hey @stefankueng, thanks for the super-quick reply! Sorry to be a dunce, but where in the GUI would I add \s+, please? And would it be possible to simply add a checkbox for this option?

All the best, Dax.

daxliniere commented 1 year ago

Hey @stefankueng, where in grepWin would I add \s+, please?

stefankueng commented 1 year ago

replace space/tabs in the search window/box with \s