escaping

Reading unescaped backslashes in JSON into R

我们两清 提交于 2019-12-11 20:20:03
问题 I'm trying to read some data from the Facebook Graph API Explorer into R to do some text analysis. However, it looks like there are unescaped backslashes in the JSON feed, which is causing rjson to barf. The following is a minimal example of the kind of input that's causing problems. library(rjson) txt <- '{"data":[{"id":2, "value":"I want to \\"post\\" a picture\\video"}]}' fromJSON(txt) (Note that the double backslashes at \\" and \\video will convert to single backslashes after parsing,

Matches not captured when using -SimpleMatch with Select-String

喜你入骨 提交于 2019-12-11 20:11:44
问题 I have been using regex to parse text within some XML nodes. However, when I use -SimpleMatch with Select-String , the MatchInfo object doesn't appear to contain any matches. I am unable to find anything online that indicates this behavior is normal. I am now wondering if it is my Powershell installation. (For reference: the computer I'm using has Powershell 3.0 installed.) Using a very simple example, we can return the expected MatchInfo Object when using the regex patterning: PS H:\> $c =

Vscode escaping a slash before using a variable

半腔热情 提交于 2019-12-11 19:15:07
问题 I was checking out the VS Code snippets the other day, and upon wanting to create a certain snippet I stumbled upon this problem: "body": [ "test=\"some\\path\\$1\"" ] I want to escape the slash after 'path' but I dont want to escape the variable, which does now happen since it's the same notation as \$. But I want to escape the slash and just let my $1 be. Any ideas on how to "unescape" this? I tried doing the string separately, but I couldnt find a way to concatenate strings either! Help

How to escape chars in BSD tar path substitution option

与世无争的帅哥 提交于 2019-12-11 16:16:08
问题 This does not work: $ tar -cf /tmp/z.tar -C /space/myroot -s '/^\.svn\/patches/__patches' src .svn/patches tar: Invalid regular expression: trailing backslash (\) Also no good: $ tar -cf /tmp/z.tar -C /space/myroot -s '/^\\.svn\\/patches/__patches' src .svn/patches tar: Invalid replacement flag _ Every combination of backslashes (up to 4) and quoting gives me one of those two errors. However I know the first one works in sed: $ tar -cf /tmp/z.tar -C /space/myroot src .svn/patches $ tar -tf

How to write a code as string variable (C#)

人盡茶涼 提交于 2019-12-11 15:49:23
问题 I'm working on exam in which when the student asked to something like (declare if statement) he will answer in Rich text box. the question is: I want to search for the input of the student in that box, and therefore, I must declare a string that contains the code (as string) something like that: string check = " string stat = "new"; if (stat == "new") { Console.WriteLine(stat); } "; However, the problem is that, the escape characters and the other preserved voids such as (if). Briefly: I want

HTMLPurifier dies when the following code is run through it

此生再无相见时 提交于 2019-12-11 15:48:21
问题 Using the latest release of HTMLPurifier with default configs. The following code will cause the oh-so-lovely blank white page in PHP. Am I missing something? Even if I set HTML.TidyLevel to light or none it still breaks. Here is a partial log of the errors thrown when trying to purify the code below: http://pastie.org/private/13f0htscq0v8bhhlt7dpg For reference, here is the associated code I'm using to do it: $config = new HTMLPurifier_Config(new HTMLPurifier_ConfigSchema()); $config->set(

jQuery is automatically escaping ajax

为君一笑 提交于 2019-12-11 15:12:00
问题 I'm using jQuery to check to see if a username is taken. My issue is that $.post seems to escape anything. For example, I use this: $.post("http://mywebsite.com/check_username.php", { "username": $("#username_txt").val() }, function(data, textstatus, xmlhttp){ // do stuff }); to send the username to the page check_username.php , which is roughly, $username = mysql_real_escape_string($_POST["username"]); echo $username; // show the perceived username echo mysql_query("SELECT * FROM users WHERE

Escaping MySQL wild cards

别等时光非礼了梦想. 提交于 2019-12-11 14:29:31
问题 On an older server I'm using that I can't use prepared statements on I am currently trying to fully escape user input before sending it to MySQL. For this I am using the PHP function mysql_real_escape_string . Since this function does not escape the MySQL wildcards % and _ I am using addcslashes to escape these as well. When I send something like: test_test " ' to the database and then read it back the database shows: test\_test " ' Looking at this I can't understand why the _ has a preceding

Why does ruby's JSON parser eat my backslash?

拜拜、爱过 提交于 2019-12-11 14:14:23
问题 The following example in JSON format contains one backslash, and if I run JSON.load , the backslash disappears: JSON.load('{ "88694": { "regex": ".*?\. (CVE-2015-46055)" } }') # => {"88694"=>{ "regex"=>".*?. (CVE-2015-46055)"}} How can I keep the backslash? My goal is to have this structure, and whenever I need, read the file, load the JSON into Hash, and search for those regular expressions. UPDATE 1 here is an example what I want. irb> "stack.overflow"[/.*?\./] => "stack." I can't pass the

C# isolate elements of an array in a string with escape character \

混江龙づ霸主 提交于 2019-12-11 13:53:45
问题 I've several arrays such as: string[] sArTrigFunctions = {"sin", "cos", "tan", "sinh", "cosh", "tanh", "cot", "sec", "csc", "arcsin", "arccos", "arctan", "coth", "sech", "csch"}; string[] sArGreek = { "alpha", "beta", "chi", "delta", "Delta", "epsi", "varepsilon", "eta", "gamma", "Gamma", "iota", "kappa", "lambda", "Lambda", "lamda", "Lamda", "mu", "nu", "omega", "Omega", "phi", "varphi", "Phi", "pi", "Pi", "psi", "Psi", "rho", "sigma", "Sigma", "tau", "theta", "vartheta", "Theta", "upsilon",