Backslashes in single quoted strings vs. double quoted strings

Double-quoted strings support the full range of escape sequences, as shown below: \a Bell/alert (0x07) \b Backspace (0x08) \e Escape (0x1b) \f Formford (0x0c) \n Newline (0x0a) \r Return (0x0d) \s Space (0x20) \t Tab (0x09) \v Vertical tab (0x0b) For single-quoted strings, two consecutive backslashes are replaced by a single backslash, and a backslash … Read more

Weird backslash substitution in Ruby

Quick Answer If you want to sidestep all this confusion, use the much less confusing block syntax. Here is an example that replaces each backslash with 2 backslashes: “some\\path”.gsub(‘\\’) { ‘\\\\’ } Gruesome Details The problem is that when using sub (and gsub), without a block, ruby interprets special character sequences in the replacement parameter. … Read more

Escaping backslash in string – javascript

For security reasons, it is not possible to get the real, full path of a file, referred through an <input type=”file” /> element. This question already mentions, and links to other Stack Overflow questions regarding this topic. Previous answer, kept as a reference for future visitors who reach this page through the title, tags and … Read more

sh read command eats backslashes in input?

Accrding to: http://www.vias.org/linux-knowhow/bbg_sect_08_02_01.html : -r If this option is given, backslash does not act as an escape character. The backslash is considered to be part of the line. In particular, a backslash-newline pair may not be used as a line continuation. It works on my machine. $ echo ‘\&|’ | while read -r in; do … Read more

Java regular expression value.split(“\\.”), “the back slash dot” divides by character?

My guess is that you are missing that backslash (‘\’) characters are escape characters in Java String literals. So when you want to use a ‘\’ escape in a regex written as a Java String you need to escape it; e.g. Pattern.compile(“\.”); // Java syntax error // A regex that matches a (any) character Pattern.compile(“.”); … Read more

How can I put an actual backslash in a string literal (not use it for an escape sequence)?

To answer your question directly, put r in front of the string. final= path + r’\xulrunner.exe ‘ + path + r’\application.ini’ But a better solution would be os.path.join: final = os.path.join(path, ‘xulrunner.exe’) + ‘ ‘ + \ os.path.join(path, ‘application.ini’) (the backslash there is escaping a newline, but you could put the whole thing on one … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)