quotes

How to run an EXE file in PowerShell with parameters with spaces and quotes

谁说胖子不能爱 提交于 2019-11-26 02:41:59
问题 How do you run the following command in PowerShell? C:\\Program Files\\IIS\\Microsoft Web Deploy\\msdeploy.exe -verb:sync -source:dbfullsql=\"Data Source=mysource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;\" -dest:dbfullsql=\"Data Source=.\\mydestsource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;\",computername=10.10.10.10,username=administrator,password=adminpass\" 回答1: When PowerShell sees a command starting with a string it just evaluates the string

PHP explode the string, but treat words in quotes as a single word

余生颓废 提交于 2019-11-26 02:09:24
问题 How can I explode the following string: Lorem ipsum \"dolor sit amet\" consectetur \"adipiscing elit\" dolor into array(\"Lorem\", \"ipsum\", \"dolor sit amet\", \"consectetur\", \"adipiscing elit\", \"dolor\") So that the text in quotation is treated as a single word. Here\'s what I have for now: $mytext = \"Lorem ipsum %22dolor sit amet%22 consectetur %22adipiscing elit%22 dolor\" $noquotes = str_replace(\"%22\", \"\", $mytext\"); $newarray = explode(\" \", $noquotes); but my code divides

Regex to split a CSV

与世无争的帅哥 提交于 2019-11-26 01:58:51
问题 I know this (or similar) has been asked many times but having tried out numerous possibilities I\'ve not been able to find a a regex that works 100%. I\'ve got a CSV file and I\'m trying to split it into an array, but encountering two problems: quoted commas and empty elements. The CSV looks like: 123,2.99,AMO024,Title,\"Description, more info\",,123987564 The regex I\'ve tried to use is: thisLine.split(/,(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*(?![^\\\"]*\\\"))/) The only problem is that in my

How to escape a double quote inside double quotes?

倾然丶 夕夏残阳落幕 提交于 2019-11-26 01:46:31
问题 Can anybody show me how to escape double quote inside a double string in bash? For example in my shell script #!/bin/bash dbload=\"load data local infile \\\"\'gfpoint.csv\'\\\" into table $dbtable FIELDS TERMINATED BY \',\' ENCLOSED BY \'\\\"\' LINES TERMINATED BY \\\"\'\\n\'\\\" IGNORE 1 LINES\" I can\'t get the ENCLOSED BY \\\" with double quote escape correctly. I can\'t use single quote for my variable because i want to use variable $dbtable . 回答1: Use a backslash: echo "\"" # Prints one

How to execute a bash command stored as a string with quotes and asterisk [duplicate]

老子叫甜甜 提交于 2019-11-26 01:42:26
问题 This question already has an answer here: Why does shell ignore quotes in arguments passed to it through variables? [duplicate] 3 answers I try to execute the following command : mysql AMORE -u username -ppassword -h localhost -e \"SELECT host FROM amoreconfig\" I store it in a string : cmd=\"mysql AMORE -u username -ppassword -h localhost -e\\\"SELECT host FROM amoreconfig\\\"\" Test it : echo $cmd mysql AMORE -u username -ppassword -h localhost -e\"SELECT host FROM amoreconfig\" Try to

Escaping Double Quotes in Batch Script

自作多情 提交于 2019-11-26 01:05:35
How would I go about replacing all of the double quotes in my batch file's parameters with escaped double quotes? This is my current batch file, which expands all of its command line parameters inside the string: @echo off call bash --verbose -c "g++-linux-4.1 %*" It then uses that string to make a call to Cygwin's bash, executing a Linux cross-compiler. Unfortunately, I'm getting parameters like these passed in to my batch file: "launch-linux-g++.bat" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -DNDEBUG -c -o "C:\Users\Me\Documents\Testing\SparseLib\bin\Win32\LinuxRelease

Escaping Strings in JavaScript

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 00:59:31
问题 Does JavaScript have a built-in function like PHP\'s addslashes (or addcslashes ) function to add backslashes to characters that need escaping in a string? For example, this: This is a demo string with \'single-quotes\' and \"double-quotes\". ...would become: This is a demo string with \\\'single-quotes\\\' and \\\"double-quotes\\\". 回答1: http://locutus.io/php/strings/addslashes/ function addslashes( str ) { return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0'); } 回答2: You

Regex to match all instances not inside quotes

你离开我真会死。 提交于 2019-11-26 00:37:35
问题 From this q/a, I deduced that matching all instances of a given regex not inside quotes, is impossible. That is, it can\'t match escaped quotes (ex: \"this whole \\\"match\\\" should be taken\" ). If there is a way to do it that I don\'t know about, that would solve my problem. If not, however, I\'d like to know if there is any efficient alternative that could be used in JavaScript. I\'ve thought about it a bit, but can\'t come with any elegant solutions that would work in most, if not all,

What are '$$' used for in PL/pgSQL

守給你的承諾、 提交于 2019-11-26 00:33:45
问题 Being completely new to PL/pgSQL , what is the meaning of double dollar signs in this function: CREATE OR REPLACE FUNCTION check_phone_number(text) RETURNS boolean AS $$ BEGIN IF NOT $1 ~ e\'^\\\\+\\\\d{3}\\\\ \\\\d{3} \\\\d{3} \\\\d{3}$\' THEN RAISE EXCEPTION \'Wrong formated string \"%\". Expected format is +999 999\'; END IF; RETURN true; END; $$ LANGUAGE plpgsql STRICT IMMUTABLE; I\'m guessing that, in RETURNS boolean AS $$ , $$ is a placeholder. The last line is a bit of a mystery: $$

Difference between single quotes and double quotes in Javascript [duplicate]

徘徊边缘 提交于 2019-11-25 23:54:23
问题 This question already has answers here : When to use double or single quotes in JavaScript? (42 answers) Closed 5 years ago . I know that in PHP, the only difference between double quotes and single quotes is the interpretation of variable inside a string and the treatment of escape characters. In JavaScript, I often see double quotes used in strings. Is there a particular reason for that, or are single quotes exactly the same as double quotes? 回答1: You'll want to use single quotes where you