Sublime Forum

Find and Replace doesn't recognise ()

#1

This one on my list of ST3 gripes (I’m sorry) is a doozy.

I want to replace some instances of “Print()” with “Print(false)”

Surely an opportunity to use find and replace, except it can’t find the ( ).

Obvs just searching for “Print” and replacing with “Print(false)” I’ll end up with “Print((false))”, no good to me.

Help much appreciated, I couldn’t easily find anything on line, this forum seemed to have nothing on the subject…

Thank you again, all the best Lzmda

Ps Pluma (the text ed supplied with Linux Mint) has no trouble with this in anyway, so it is possible…

0 Likes

#2

Do you perhaps have regex search enabled? Alt+R or the button on the top left toggles regex search. Alternatively you can escape the () by using \(\).

0 Likes

#3

Sorry I’m a noob, pressing ctrl+r did nothing, how do I disable the regex search?
Thanks for your very quick reply !

Okay I’ve found the “.*” button to the left in the find and replace bar. It finds “Print”, but ignores the brackets and the final result is “Print(false)()”

0 Likes

#4

Alternatively you can escape the () by using \(\) .

have tried “Print()”, I still get the same error, and it doesn’t work…

Ah
Oh this forum won’t allow me to type \(\) . Jeesh.
I’ve tried
Print()
Sorry I don’t seem to be able to get this box in typing in to allow me to type the series of characters you suggested i try in conjunction with Print, but I have tried, even if I can’t tell you about it. Crikey even the forum won’t let me use those charcters !!

0 Likes

#5

When the button is not highlighted replacing print() with print(false) should work. The key combination is alt+r not ctrl+r on linux (and probably windows).

0 Likes

#6

With the button unselected, it doesn’t work, the error is unable to find “Print”

Thanks

0 Likes

#7

This should work just fine

If you know the case of what you’re trying to find will always be Print() then you can tick on the case sensitive option, and you could also tick on whole word search, but as you can see, this should work just fine without either option in the most basic case.

The far left icon (in my image, the E icon, it could be different for you based on theme) is for regex searches and that should be ticked off as it is in this screenshot.

0 Likes

#8

In addition to the excellent answer by @normally, here’s a video clip showing this working in action as well. Note that the look of the buttons depends on your theme, but the tooltip will remind you which button is which.

4 Likes

#9

Cripes, it was as simple as taking off case sensitivity and whole word…
Crumbs.

Thank you normally, and once again, OdatN

(Don’t know whether to be happy or have a little cry, it was soo frustrating the other day !)

0 Likes

#10

Ps Great vid, Thank you

0 Likes