I try to get rows from an XML file with grep, but I’m not so good with regular expressions yet and I don’t know which characters I need to escape in order to get this regular expression string to work:
grep -o -P '<row value="[a-zA-Z0-9\-\.\/:=_]*" count="[0-9]*">[a-zA-Z0-9\-\.\/:=_]*</row>'
I tried escaping every character, but that didn’t work. What is the solution?
You regex does not allow spaces in the text. The text you are trying to match has
Test Testerwhich won’t match your pattern[a-zA-Z0-9\-\.\/:=_ ]*. You need to add a space to it.Try this: