I am using regex to determine a command line argument has the .dat extension. I am trying the following regex:
#define to_find \"^.*\\.(dat)?\"
You need
#define to_find "^.*\\.(dat)?"
Should do the trick as the \ needs to be escaped for C and not the benefit for regex at this stage