quotes
Regex to split a CSV
Description Instead of using a split, I think it would be easier to simply execute a match and process all the found matches. This expression will: divide your sample text on the comma delimits will process empty values will ignore double quoted commas, providing double quotes are not nested trims the delimiting comma from the … Read more
Why doesn’t Python give any error when quotes around a string do not match?
The final “”” is not recognized as a triple-quotation, but a single ” (to close the current string literal) followed by an empty string “”; the two juxtaposed string literals are concatenated. The same behavior can be more readily recognized by putting a space between the closing and opening “. >>> “not OK” “” ‘not … Read more
Is there any difference between “string” and ‘string’ in Python? [duplicate]
No: 2.4.1. String and Bytes literals …In plain English: Both types of literals can be enclosed in matching single quotes (‘) or double quotes (“). They can also be enclosed in matching groups of three single or double quotes (these are generally referred to as triple-quoted strings). The backslash (\) character is used to escape … Read more
What is the use case for Ruby’s %q / %Q quoting methods?
They’re extraordinarily useful for escaping HTML with JavaScript in it where you’ve already “run out” of quoting methods: link = %q[<a href=”https://stackoverflow.com/questions/10144543/javascript:method(“call’)”>link</a>] I’ve also found them to be very useful when working with multi-line SQL statements: execute(%Q[ INSERT INTO table_a (column_a) SELECT value FROM table_b WHERE key=’value’ ]) The advantage there is you don’t need … Read more
Dealing with quotes in Windows batch scripts
set “myvar=c:\my music & videos” Notice the quotes start before myvar. It’s actually that simple. Side note: myvar can’t be echoed afterwards unless it’s wrapped in quotes because & will be read as a command separator, but it’ll still work as a path. http://ss64.com/nt/set.html under “Variable names can include Spaces”
Regex to match all instances not inside quotes
Actually, you can match all instances of a regex not inside quotes for any string, where each opening quote is closed again. Say, as in you example above, you want to match \+. The key observation here is, that a word is outside quotes if there are an even number of quotes following it. This … Read more
Escaping Strings in JavaScript
http://locutus.io/php/strings/addslashes/ function addslashes( str ) { return (str + ”).replace(/[\\”‘]/g, ‘\\$&’).replace(/\u0000/g, ‘\\0’); }
bash regex with quotes?
It was changed between 3.1 and 3.2. Guess the advanced guide needs an update. This is a terse description of the new features added to bash-3.2 since the release of bash-3.1. As always, the manual page (doc/bash.1) is the place to look for complete descriptions. New Features in Bash snip f. Quoting the string argument … Read more
How does the leading dollar sign affect single quotes in Bash?
It causes escape sequences to be interpreted. $ echo $’Name\tAge\nBob\t24\nMary\t36′ Name Age Bob 24 Mary 36 After those sequences are expanded, the result is single-quoted, as if the dollar sign had not been present.