How your editor treats a backslash

Door Rob van den Berg In Oracle

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!

which concludes my post…

Meer informatie

rob-van-den-berg1

Rob van den Berg

Oracle Database Consultant

+31 6 22 98 69 27 Stuur Rob een e-mail

Reacties

Er zijn nog geen reacties op dit bericht.

Plaats een reactie

Dit veld is verplicht.

Vul een geldig e-mailadres in.

Dit veld is verplicht.