Ilguiz Latypov created GROOVY-9019: -------------------------------------- Summary: triple-single and triple-double quotes handle backslash escapes equally Key: GROOVY-9019 URL: https://issues.apache.org/jira/browse/GROOVY-9019 Project: Groovy Issue Type: Documentation Components: Documentation Reporter: Ilguiz Latypov
The documentation implies that triple-single quotes treat only escaping of single quotes with backslashes. {code:java} |'\'' 316 |single quote (for single quoted and triple single quoted strings) 317 318 |'\"' 319 |double quote (for double quoted and triple double quoted strings) {code} [https://gitbox.apache.org/repos/asf?p=groovy.git;a=blob;f=src/spec/doc/core-syntax.adoc;h=30b48fdfb4caafacae343f5dac9dde3372da65b2;hb=HEAD#l315] My quick tests show that regardless of the surrounding triple quotes, backslash escaping works equally on single and double quotes. {code:java} s = '''foo\"bar''' println "The triple-single-quoted string with a backslash-double-quote inside: ${s}" s = """foo\'bar""" println "The triple-double-quoted string with a backslash-single-quote inside: ${s}" {code} {code:java} The triple-single-quoted string with a backslash-double-quote inside: foo"bar The triple-double-quoted string with a backslash-single-quote inside: foo'bar {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)