0
Answered

Replace With Backslashes Misbehaving

Rich Lowe 3 weeks ago in iPad updated by rich123 3 weeks ago 11

If your file contains \\\`

and you try to replace \\\` with \`, it only selects \\` instead of \\\` for replacement.

Thanks for all you do!

You're probably using Regular Expression as your search type, and the 1st backslash is being interpreted as an escape character.

Change your Search type to Text (under the gear icon) and it will work.

that was the first thing I checked, I wasn’t 

+1

When I typed in 5 backslashes, then it selected 3 and worked. But 3 and 4 backslashes only selected 2. Good catch! I hadn't encountered this yet. Thank you.


+1
Answered

You need to escape each backslash. To find one backslash, enter \\. To find three backslashes enter \\\\\\ (6 backslashes). 

That is because you can search for \t to find tabs and \n to find newlines. 

+2

if regex not checked, why not treat \ as literal?

or copy notepad++. Normal (literal), Extended (\n \r \t..), Regex

or vs code. Normal (literal), Regex

Well, that would be another option. But it currently behaves as documented in the manual:

https://www.textasticapp.com/v10/manual/managing_files/find_in_files.html#settings


Text

Search for a simple text string. You can also search for “\n” or “\r” to find newline characters and “\t” to find tab characters. Enter “\\” to search for a backslash.

Regular Expression

Enable regular expression search. Textastic uses the ICU regular expression syntax.

Thank you, Alexander.

-1

My understanding for getting Textastic is that it's a great text editor for Programmer's, created with programmer's in mind. That's why I got it.

Typing an escape character to have the benefit of \t and \n and maybe more (\r ?), in a Search is well worth the trade off.

I would not vote for the option of: Normal, Extended, and Regex.

I like Textastic just the way it is now.

do you really like it when in your second reply you admitted you hadnt encountered it

you werent affected like rich lowe that is why you like Textastic just the way it is now.

vs code and notepad++ a great text editor for Programmer's, created with programmer's in mind, does not need to escape \

maybe a toggle for literal search is better or a toggle for extended search. no requirement to read the manual

escaping \ is archaic like using vim, no offense to vim users