escaping

Bash echo command not making use of escaped character

我只是一个虾纸丫 提交于 2019-12-01 06:54:33
问题 The bash echo command isn't using the escaped characters like "\n" and "\t" echo "This is test string\nAnd this is next line" For the above input it displays This is test string\nAnd this is next line So how do I print on the next line? 回答1: You need echo -e if you want escaped characters to be expanded: $ echo -e "This is test string\nAnd this is next line" This is test string And this is next line 回答2: $ echo $'This is test string\nAnd this is next line' This is test string And this is next

Unmarshalling XML with JAXB without unescaping characters

。_饼干妹妹 提交于 2019-12-01 06:46:36
问题 imagine following situation: we receive a xml file from some external tool. Lately within this xml, there can be some escaped charakters in nodenames or within their richcontent tag, like in the following example (simplyfied): <map> <node TEXT="Project"> <node TEXT="ää"> <richcontent TYPE="NOTE"><html> <head> </head> <body> <p> I am a Note for Node ää! </p> </body> </html> </richcontent> </node> </node> </map> After unmarshalling the file with JAXB those escaped charakters get unescaped.

How to escape certain characters in java

喜欢而已 提交于 2019-12-01 06:43:36
问题 I need to escape characters like ^ , . , [ , ] , + and \ (tabs and newlines won't be an issue), while leaving others like * and ? . EDIT = More specifically, I have a string with these characters, and I need to escape them so that they are not matched by regular expressions. I need to prepend \ to each of these characters, but doing so individually would take 7 or 8 scans and I'd like to do it within just one pass (IE: anything that matches is prepended with \ ) How do I do this? Thanks. 回答1:

Unescape apostrophe (') in JavaScript?

余生颓废 提交于 2019-12-01 06:35:39
I'm trying to unescape a HTML-escaped apostrophe ( "'" ) in JavaScript, but the following doesn't seem to work on a devtools console line: unescape('''); The output is simply: "'" It doesn't work in Underscore's unescape either: _.unescape(''') What am I doing wrong? unescape has nothing to do with HTML character entities. It's an old, deprecated function for decoding text encoded with escape , which is an old, deprecated function for encoding text in a way that is unlikely to be useful in the modern world. :-) If you need to turn that HTML into plain text, the easiest way is via an element:

Unescaping characters in a string with Ruby

青春壹個敷衍的年華 提交于 2019-12-01 06:17:16
问题 Given a string in the following format (the Posterous API returns posts in this format): s="\\u003Cp\\u003E" How can I convert it to the actual ascii characters such that s="<p>" ? On OSX, I successfully used Iconv.iconv('ascii', 'java', s) but once deployed to Heroku, I receive an Iconv::IllegalSequence exception. I'm guessing that the system Heroku deploys to does't support the java encoder. I am using HTTParty to make a request to the Posterous API. If I use curl to make the same request

Explain Backslash in C

◇◆丶佛笑我妖孽 提交于 2019-12-01 05:49:52
Can anyone please explain the below code and please also explain the role of backslash( \ ) in such situations. And what \' , \" , \ooo , \ \ , \? means? #include <stdio.h> int main(){ char a = '\010'; char y = '010'; printf("%d,%d",a,y); return 0; } output: 8,48 This '\010' is a octal escape sequence 10 in octal is 8 in decimal and it will be promoted to an int when calling printf so that explains that value. This '010' is a multi-character constant and it's value is implementation defined, if we look at the C99 draft standard section 6.4.4.4 Character constants paragraph 10 says( emphasis

Escape characters in Cucumber step definition

落花浮王杯 提交于 2019-12-01 05:42:00
问题 I have following steps that I am using for Cucumber-jvm. How do I escape certain characters in my step definitions? When user verifies if ABC widget exists Then the 'The 7 Things $channel' label is displayed In this case I need to escape 7 and $ as a regular string. 回答1: You could do this, Then the /'The 7 Things $channel' label is displayed/ Corresponding Step def would be, @Then("^the /'The 7 Things \\$channel' label is displayed/$") public void the_The_Things_$channel_label_is_displayed()

SQL Escape ' '

烈酒焚心 提交于 2019-12-01 05:40:18
I am trying to run a query in SQL 2008 by doing: @query varchar(max) SET @query = 'SELECT * FROM Table WHERE [Name] = ' 'Karl' ' ' EXEC(@query) The problem is that for some reason the apostrophes around 'Karl' don't get escaped, i.e. the query executes as ...WHERE [Name] = Karl and fails. Anyone have a suggestion? Thanks Karl There are several ways that you can escape character data in SQL Server, some people even advocate the use of the QUOTENAME() functions. If you really want to develop of solid understanding of this subject area then may I recommend that you take a look at what experienced

How can regex ignore escaped-quotes when matching strings?

做~自己de王妃 提交于 2019-12-01 05:36:35
I'm trying to write a regex that will match everything BUT an apostrophe that has not been escaped. Consider the following: <?php $s = 'Hi everyone, we\'re ready now.'; ?> My goal is to write a regular expression that will essentially match the string portion of that. I'm thinking of something such as /.*'([^']).*/ in order to match a simple string, but I've been trying to figure out how to get a negative lookbehind working on that apostrophe to ensure that it is not preceded by a backslash... Any ideas? - JMT <?php $backslash = '\\'; $pattern = <<< PATTERN #(["'])(?:{$backslash}{$backslash}?+

Is Oracle's EXTRACT function breaking the NOENTITYESCAPING in the XMLELEMENT?

穿精又带淫゛_ 提交于 2019-12-01 05:26:20
Oracle 11g. I figured out that if I add NOENTITYESCAPING to the XMLELEMENT function, it nicely turns off entity escaping. However, when I then pass the result to EXTRACT the escaping seems to come back again. select xmlelement(NOENTITYESCAPING e,id,'->') from (select level as id from dual connect by level < 6) XMLELEMENT(NOENTITYESCAPINGE,ID,'->') --------------------------------------- <E>1-></E> <E>2-></E> <E>3-></E> <E>4-></E> <E>5-></E> Now, adding EXTRACT : select xmlelement(NOENTITYESCAPING e,id,'->').extract('//text()') from (select level as id from dual connect by level < 6) XMLELEMENT