How To Use Backreference in Grep
$ echo 'CONSTRAINT `helloworld` FOREIGN KEY' | grep -oP '(?<=CONSTRAINT `).*(?=` FOREIGN KEY)'helloworld
-o, --only-matching show only the part of a line matching PATTERN-P, --perl-regexp PATTERN is a Perl regular expression
(?=pattern) is a positive look-ahead assertion(?!pattern) is a negative look-ahead assertion(?<=pattern) is a positive look-behind assertion(?<!pattern) is a negative look-behind assertion