To write text in a scrape instruction you create strings which are just a series of characters. A string is delimited by double ("
) or single quotes ('
). If a string is started with a double quote it must end with a double quote, if a string starts with a single quote it must end with a single quote. For instance:
"my-class"
and 'my-class'
A common error that can occur is the unclosed string error, this is when a string does not have a closing quote as shown above or there is a line break in the string. The following are illegal strings:
"my
class"
"my class
To fix this error is to ensure they do not contain line breaks and have matching quotes, like so:
"my class"
and "my class"
Sometimes you want a single or double quote to appear in a string. The easiest way to do this is to put a single quote in a string delimited with double quotes and a double quote in a string delimited with single quotes, like so:
"Bob's shop"
and '"The best store on the web"'
Alternatively you can use a backslash to escape a quote like so:
'test\'s'