I have a Magento 2 installation where I am attempting to find any syntactiaclly incorrect xml files.
I am trying to use the below command to find any acl.xml files in the code
dir that contain a node labelled resource
but missing an id
attribute.
I have tested this regex code on an online regex tester successfully:
<(?:resource)(?:\s+(?!id\b)[\w\-.:]+(?:\s*=\s*(?:"[^"]*"|\'[^\']*\'|[\w\-.:]+))?)*\s*/?>
When I try to use the below command however, I get an error:
find app/code -type f -name "acl.xml" | xargs ack '<(?:resource)(?:\s+(?!id\b)[\w\-.:]+(?:\s*=\s*(?:"[^"]*"|\'[^\']*\'|[\w\-.:]+))?)*\s*/?>'
-bash: syntax error near unexpected token `)'
Any idea why this command is not working?
'. . . |\'[^\']*\'| . . .'
. One option that may work is to close and reopen the outer quoting i.e.|'\''[^'\'']*'\''|