what is wrong n the function <https://trycf.com/gi...
# cfml-general
g
what is wrong n the function https://trycf.com/gist/e4be632ffd462fbd40c14c1ec01b0902/lucee5?theme=monokai getting Error: Invalid Syntax Closing [#] not found on line 3
b
You have to escape pound signs
Copy code
<cfset var resultString = Replace(inputString, '##', '####', 'ALL')>
Also, this is not how you escape quotes in CFML
Copy code
<cfset myString = "P-1 test #1 'example' \"example\"">
You double them up like this:
Copy code
<cfset myString = "P-1 test #1 'example' ""example""">
And THEN the hash needs escaped in that line as well like so
Copy code
<cfset myString = "P-1 test ##1 'example' ""example""">
And these lines are likely wrong if you're trying to escape things based on CFML rules
Copy code
<cfset resultString = Replace(resultString, "'", "\'", 'ALL')>
<cfset resultString = Replace(resultString, '"', '\"', 'ALL')>
Since you double them up in CF instead of using backslashes
@gsr Did you see my answer ☝️
g
yes, Thanks for the answer, it does make sense,
👍 1