menu
sluiten
terug naar overzicht

30/04/18

insight

Oracle

Rob van den Berg

+31 6 22 98 69 27


30/04/18

How your editor treats a backslash

This post is about escaping in Notepad++, escaping from what is commonly called a backslash. It is a typographic mark also denoted by a reverse slash or backslant, among others . When coding, many programming languages recognize this special character as a token to signal the compiler to treat the character following the backslash either normally ( if it would be treated specially when not preceded by the backslash ) or specially ( if it would otherwise be treated normally).

In particular, in many programming languages, a backslash followed by a single quote would cause that quote NOT to be treated as a normal single quote.

Note that in SQL, just as in PL/SQL, a backslash does not have this special meaning. This means the following PL/SQL code will just be compiled succesfully:

Backslashcode

However when using Notepad++ to automatically apply suitable styles to recognized language code elements, like I have done above, the default configuration would tempt the Notepad++ styler to unintentionally ignore the single quote following the backslash. So by default, the code above will be displayed in Notepad++ as shown below:

Backslash Notepad++default

Fortunately, like shown in the first example, Notepad++ can be configured not to treat the backslash character like that in SQL or PL/SQL, under preferences – miscellaneous:

 

Backslash Notepad++

Recommended Notepad++ preference!

Delen

Meer weten over dit onderwerp?

Neem contact op met Rob van den Berg