when testing if an identifier refers to a calculated aesthetic, check the whole identifier, not a substring

also, define the regex that is used for matching only once, in a hidden global variable

fixes #834

Conflicts:
	R/layer.r

Resolved by combining.