The use case is rather simple. I have a text file, say the following named eg.txt:
'simple_example': 345, 'to_demonstrate': 232,
'regex': 'is not easy to use'
I am trying to capture the keys:
grep -oP (?<=')[a-zA-Z_0-9]+(?=':) eg.txt`txt
It gives me error:
-bash: syntax error near unexpected token `('
Escaping the single quote does not help either:
grep -oP (?<=\')[a-zA-Z_0-9]+(?=\':) eg.txt
Nor does using extended grep help:
grep -oE (?<=')[a-zA-Z_0-9]+(?=':) eg.txt
What is happening here? I am using linux bash with Windows 10 WSL.