When searching for a double quote using Instr, I know that you need to use 4 double quotes for the search string Instr(String,"""")
, or alternatively, Instr(String, Chr(34))
.
What I don't quite understand is why 3 double quotes don't work Instr(String,""")
I have Googled for this, but haven't come across the answer I'm looking for. I realize this is a very basic question, but I can't seem to get my head around it.
To check if the string has double quotes you can use: text_line. Contains("\""); Here \" will escape the double-quote.
Whenever you use a grep regular expression at the command prompt, surround it with quotes, or escape metacharacters (such as & ! . * $ ? and \ ) with a backslash ( \ ). finds any line in the file list starting with "b." displays any line in list where "b" is the only character on the line.
Firstly, double quote character is nothing special in regex - it's just another character, so it doesn't need escaping from the perspective of regex. However, because Java uses double quotes to delimit String constants, if you want to create a string in Java with a double quote in it, you must escape them.
The ""
is just quoting a "
- therefore, """
means "_here comes a double quote
- and VBA lacks the closing "
!
In other words:
x = ""
-> Content of is blankx = """"
-> Content of x is "
x = """
-> VBA cannot compile, as it reads here comes a string (the first "
) that contains a double quote (""
) - but then does not find the closing "
...If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With