I'm trying to build a regex to match any .c or .h pattern whithin modified file of git status -s.
(Find the regex here: regexr.com/40afj )
(?:M).*.[c|h]
to be used on this king of data:
M fjdkls/fjdkslm/djks.c
M fjdkls/fjdkslm/djks.c
M fjdkls/fjdkslm/djks.h
M fjdkls/fjdkslm/djks.h
?? fjdkls/fjdkslm/djks.c
?? fjdkls/fjdkslm/djks.c
Can you explain me why the M is matching even if it is in a non-capturing group?
The expected result is to match full path of modified file.