Menu

escaping \t

2007-12-12
2012-11-13
  • Nobody/Anonymous

    Hello,

    I can't seem to figure out how to escape \t in the replace dialog. I'm working on a latex file and needed to replace a string with "\times" but that inserts "<tab>imes" and "\\times" inserts "\&lt;tab>imes". So, how does one escape slash-chars?

    Thanks,
    Nathaniel

     
    • Nobody/Anonymous

      Sorry for the confusion, my last post was in response to "and without regular expression checked, how would you insert a tab?"

      For those of you who are more in tune with the development side of Notepad++, does this appear to be a bug in Scintilla? It appears to be a bug, regardless, as \\t should produce a \t in the replaced text and not a \TAB.

      Possibly this has been addressed in an updated version of Scintilla (latest is 1.75), so you might try asking over on their forum (if they have one) to see if there is another way to tackle this?

       
    • FlakRat

      FlakRat - 2007-12-12

      If you don't need regular expressions for this particular search and replace, unchecking "Regular Expression" should get you going.

       
    • Nathaniel Troutman

      I am using regular expressions.

      In particular, searching for:

      (\d+\.\d+)x\$10^\{(\d+)\}\$

      wanting to replace with:

      $\1\\times10^{\2}$

      Thanks for the reply though.

       
    • Nobody/Anonymous

      interesting problem (trying to use \t in the replace)

      there's probably no way to do it - without checking regular expression - and without regular expression checked, how would you insert a tab?

      i think there's (usually) nothing wrong with doing "two part" find and replaces

       
      • Nobody/Anonymous

        Perhaps this is another nice opportunity for someone to promote their Simple Script Plug-In?

         
    • Nobody/Anonymous

      without checking -----> (i meant) without UNchecking

       
    • FlakRat

      FlakRat - 2007-12-12

      There is a way to insert a tab without using Regex :-)

      In the text, hit the TAB key to temporarily create a tab, highlight the tab and copy to the clipboard.

      Then delete it, bring up the search and replace and in the replace field, paste the tab character where ever you need it.

      Works great, although it's a hokie way to do it.

       
      • Nobody/Anonymous

        So, can we also do an "undo-like" behavior for that?

        That is to say, I believe the original question was how to NOT insert a tab, but the plain text "\t", while using a regex to find it.

         
      • pshute

        pshute - 2007-12-12

        In the advanced Find/Replace, if regex is disabled, you can use control+I or control+M wherever you want a tab or newline in the find or replace string.

         
    • Nathaniel Troutman

      Thanks for the responses guys, but several of you are misunderstanding what I'm trying to do. I want to search using regex and replace with text that contains a literal "\t", a backslash followed by the letter T.

      The intuitive (at least to programmers) way of doing this is that "\\&quot; is a literal backslash and it won't escape things, i.e. "\\t" would turn into "\t" not "\&lt;tab>" when the search and replace was done.

       
    • FlakRat

      FlakRat - 2007-12-17

      I downloaded the latest version of SciTE (Scintilla's demo text editor) based on Scintilla 1.75 and it exhibits the exact same behavior.

      search: times
      replace: \\times

      expected output: \times
      actual output: \&nbsp;  imes

      I'd recommend opening a bug with Scintilla as it will eventually propagate to Notepad++.