import re

text = "P(x,y) and Q(x,y)"

characters_before = re.findall(r'(.)\(', text)

print(f"All characters before '(': {characters_before}")
