in reply to one line regular expression
Parsing tagged data with regular expressions is always error-prone, but if you know that your data is not too crazy, you can get pretty far with it:
perl -lne 'print qq($2.$1) if /<metaatribute metaattribute-name="([^"] +*?)" metaobject-name="([^"]*?"/'
If you want to run this on Win32, you have to fiddle around with the double and single quotes. I'd try the following then:
perl -lne "$q = chr(34); print qq($2.$1) if /<metaatribute metaattribu +te-name=$q([^$q]*?)$q metaobject-name=$q([^$q]*?$q/"
Update: shmem spotted a typo in my print statements
|
|---|