escaping

Java Regex - Split string on spaces - Ignore spaces in quotes and escaped quotes [duplicate]

别来无恙 提交于 2019-12-31 05:19:21
问题 This question already has answers here : Splitting a nested string keeping quotation marks (3 answers) Closed 3 years ago . I'm looking for regex to do the following in Java: String originalString = ""; String splitString[] = originalString.spilt(regex); Some test cases: Original1: foo bar "simple" Spilt1: { "foo", "bar", "\"simple\"" } Original2: foo bar "harder \"case" Spilt2: { "foo", "bar", "\"harder \"case\"" } Original3: foo bar "harder case\\" Spilt3: { "foo", "bar", "\"harder case\\""

Java Regex - Split string on spaces - Ignore spaces in quotes and escaped quotes [duplicate]

隐身守侯 提交于 2019-12-31 05:18:07
问题 This question already has answers here : Splitting a nested string keeping quotation marks (3 answers) Closed 3 years ago . I'm looking for regex to do the following in Java: String originalString = ""; String splitString[] = originalString.spilt(regex); Some test cases: Original1: foo bar "simple" Spilt1: { "foo", "bar", "\"simple\"" } Original2: foo bar "harder \"case" Spilt2: { "foo", "bar", "\"harder \"case\"" } Original3: foo bar "harder case\\" Spilt3: { "foo", "bar", "\"harder case\\""

Using dollar sign in sed for both variable replacement and character

前提是你 提交于 2019-12-31 03:50:09
问题 I try to use sed to change a line in a file named convergence.gnu I have a variable named lafila , which is a file name Currently, I can do: lafila="nGas060.dat" sed -i "6s/.*/plot \"$lafila\" using 1:2 with l/" convergence.gnu This changes correctly the sixth line of my convergence.gnu file to: plot "nGas062.dat" using 1:2 with l However, now I want to include a dollar sign in the replaced line to obtain instead: plot "nGas062.dat" using ($1/1000):2 with l Can you tell me what to change in

CFQUERY Not escaping single quotes properly [duplicate]

一世执手 提交于 2019-12-31 02:58:11
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Coldfusion adding extra quotes when constructing database queries in strings All, I am trying to use a getter to reference a bean during an insert. CF is not escaping the single quote properly in the value in 'form.title' and therefore I am receiving a malformed sql error. Any ideas? Here's the code. <cfscript> form.title = "page's are awesome"; page = new model.page.page(argumentCollection = form); <cfquery

php string escaping like python's “”“ ”“”?

烂漫一生 提交于 2019-12-31 02:11:26
问题 Hi I was wondering if there is an easy way to escape strings in php. In python I use """ """, and everything between there is escaped. so when using special characters it is ignored. I have some text to echo, and escaping everything manually just takes forever. Does php have a similar function built in ? thanks! 回答1: Which are the characters do you have to escape? You could use single quotes [docs]. The only characters that have to be escaped in such a string are \ and ' . If you have a long

php string escaping like python's “”“ ”“”?

我怕爱的太早我们不能终老 提交于 2019-12-31 02:11:03
问题 Hi I was wondering if there is an easy way to escape strings in php. In python I use """ """, and everything between there is escaped. so when using special characters it is ignored. I have some text to echo, and escaping everything manually just takes forever. Does php have a similar function built in ? thanks! 回答1: Which are the characters do you have to escape? You could use single quotes [docs]. The only characters that have to be escaped in such a string are \ and ' . If you have a long

Writing html in a string

久未见 提交于 2019-12-30 18:27:21
问题 I'm trying a write a couple small lines of html in my java class that gets some data from another API. I get the data in a JSON string, and would then like to display some of it on a webpage. To create the HTML, I try: StringBuilder sb = new StringBuilder(); for(int i=0;i<leads.size();i++){ sb.append("<p>Name: "+leads.get(i).getFirstName()+" "+leads.get(i).getLastName()+"</p>"); sb.append("<p>Email: "+leads.get(i).getEmail()+"</p>"); sb.append("<br />"); } fullLeadData = sb.toString(); But

Escape HTML entities in JSP / JSPX: no solution for problem that should not even exist?

坚强是说给别人听的谎言 提交于 2019-12-30 16:50:53
问题 We use jspx as template engine. We have dozen of screens with hundreds of el expressions like ${user.firstName} or "${mail.subject}" And all this HTML code is not escaped by default. If there would be something with < or " in field -- screen will fail. We can always use fn:escapeXml but doing so in all places really boring. 1) Does there is a way to do escape by default? The only way I know is to hack JSP compiler (like jasper for tomcat). But it is not a way to go. 2) Why somebody may ever

Pass semicolon in Ant as a parameter

不想你离开。 提交于 2019-12-30 11:11:25
问题 I want to pass ";;;" string as a string parameter in my Ant task: <mytask param=";;;"/> but Ant consider semicolon as a special symbol and raises an error java.lang.IllegalArgumentException: Illegal group reference how can I escape ; symbol to pass it to Ant? p.s. also I found that I can't pass { symbol, so I wonder what's the common way to escape characters in Ant? I've tried "$;$;$;" but it's not working for me UPDATE: sample code: public class MyTask extends Task { private String value;

Handling percent-sign (%) in Django blocktrans tags

这一生的挚爱 提交于 2019-12-30 09:23:11
问题 I'm currently localizing my Django app. All other translations work fine except percent-sign inside blocktrans tags. In my template I have {% blocktrans %}Original % blocktrans{endblocktrans %} . django-admin makemessages produces this in django.po: #: templates/index.html:78 #, python-format msgid "Original %% blocktrans" msgstr "" I update that to msgstr "Translated %% blocktrans" , run django-admin compilemessages , restart dev server and refresh the page, but I still see Original %