backslash

Need to select only data that contains backslashes in MySQL

て烟熏妆下的殇ゞ 提交于 2019-11-28 07:55:24
问题 I'm attempting to correct entries in a database that have been double-escaped. I believe magic_quotes was on while mysql_real_escape_string was being used. The double-escaping has caused some search results to be incorrect/missing. I've turned magic_quotes off and am planning to search for entries with a backslash and update them to remove any double-escaping. Trouble is, when I perform a query to search for entries with backslashes, I always get no results. SELECT title FROM exampletable

Replacing single backslashes with double backslashes in php

自作多情 提交于 2019-11-28 06:45:55
问题 I came across a strange problem in my PHP programming. While using the backtrace function to get the last file the PHP compiler was working with. It would give it to me the path using backslashes. I wanted to store this string in the database, but MySQL would remove them; I'm assuming it was thinking I wanted to escape them. So C:\Path\To\Filename.php would end up C:PathToFileName.php in the database. When I posted this question to Google, I found many others with the same problem but in many

Replace single backslash with double backslash

浪尽此生 提交于 2019-11-28 02:33:54
问题 It seems simple enough, right? Well, I don't know. Here's the code I'm trying: input = Regex.Replace(input, "\\", "\\\\\\"); However, I'm receiving an error, ArgumentException was unhandled - parsing "\" - Illegal \ at end of pattern. How do I do this? 回答1: The first one should be "\\\\" , not "\\" . It works like this: You have written "\\" . This translates to the sequence \ in a string. The regex engine then reads this, which translates as backslash which isn't escaping anything, so it

Add backslash to String in Objective-c

你离开我真会死。 提交于 2019-11-28 02:13:23
I have a problem identical to this problem here . I even want to encode the same infromation as him (it's a date/time for asp.net)... When ever I try to add a backslash i get two backslashes since I used \. Everyone in the thread above has claimed that this is a problem with NSLog and that NSString does treat \\ as a \ . I have checked this further by using a packet sniffer to examine the packets I'm sending to the webserver and I can confirm that it is transmitting a double backslash instead of a single backslash. Does anyone know how to add a backslash to a NSString? The strings and NSLog

Why do backslashes disappear when run through echo?

99封情书 提交于 2019-11-28 01:09:24
问题 I have code like this, which processes a CSV file: #!/bin/bash while read line do variable=$(echo $line | awk -F, '{print $2}') echo $variable done < ./file.csv If the CSV file contains any \ , when I run this command, the output text does not show the \ . How can I ensure that \ is not deleted? 回答1: The reason for this behaviour is that the read builtin uses \ as escape character. The -r flag disables this behaviour. So, this should work: while read -r line variable=$(echo $line | awk -F, '

How to replace a double backslash with a single backslash in python?

大城市里の小女人 提交于 2019-11-27 20:30:58
I have a string. In that string are double backslashes. I want to replace the double backslashes with single backslashes, so that unicode char codes can be parsed correctly. (Pdb) p fetched_page '<p style="text-align:center;" align="center"><strong><span style="font-family:\'Times New Roman\', serif;font-size:115%;">Chapter 0<\\/span><\\/strong><\\/p>\n<p><span style="font-family:\'Times New Roman\', serif;font-size:115%;">Chapter 0 in \\u201cDreaming in Code\\u201d give a brief description of programming in its early years and how and why programmers are still struggling today...' Inside of

Why do I have to use double backslashes for file-paths in code?

谁说胖子不能爱 提交于 2019-11-27 18:25:52
问题 In my program I'm trying to open a file, for example C:\unescaped\backslashes.txt , but it fails to open! Why? What is this? This is a collection of common Q&A. This is also a Community Wiki, so everyone is invited to participate in maintaining it. Why is this? There are a lot of questions in the site which boil down to OP not knowing he/she needs to escape backslashes in file paths in the source code. The questions are usually "Why is my program not working?" or "Why is the file not found?",

Add backslash to string

一曲冷凌霜 提交于 2019-11-27 17:43:05
问题 I have a path and I want to add to it some new sub folder named test. Please help me find out how to do that. My code is : string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); Console.WriteLine(path+"\test"); The result I'm getting is : "c:\Users\My Name\Pictures est" Please help me find out the right way. 回答1: Do not try to build pathnames concatenating strings. Use the Path.Combine method string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)

What is the purpose of a backslash at the end of a line?

孤街醉人 提交于 2019-11-27 09:42:43
Just found the following module import in a Python code: from sqlalchemy.ext.declarative import declarative_base,\ AbstractConcreteBase I am curious about the backslash \ at the end of the first line. What's the purpose of it? Wouldn't it be the same as the following? from sqlalchemy.ext.declarative import declarative_base, AbstractConcreteBase Yep, it's exactly the same and this is the point of the backslash — it escapes the newline, allowing this long line to be split in two. An alternative is to use parentheses: from sqlalchemy.ext.declarative import (declarative_base, AbstractConcreteBase)

Javascript: Replace backslashes with double backslashes

落花浮王杯 提交于 2019-11-27 08:25:23
问题 I'm currently having the problem mentioned in the title and I'm somehow not finding a way to properly replace backsashes with double backslashes, so that I can properly give the string to a webservice as parameters. Let me show you what I tried. Some of these do actually work for some other people, but not for me... I'm currently testing this with FF18.0.1 WSParameters.replace(/\\/g, "\\\\\\\\"); WSParameters.replace("\\", "\\\\\\\\"); WSParameters.replace(/\\/g, "\\\\"); WSParameters.replace