The x option indicates that most white space should be ignored. That allows me to use spaces to break up the regex a little to make it easier to see where each field is.
The first field is captured by (\S+)\s+ which grabs the first sequence of non-space characters from the start of the line.
The second field is captured by ([^:]+):\s+ which matches and captures a sequence of characters excluding ':', then matches the ':' and any following white space.
The third field is a little more interesting. ((?:(?!\s*\(rev).)+))\s* crawls along the remainder of the line matching and capturing one character at a time until it comes to '(rev' preceeded by any amount of white space. The (?:...) bit groups some stuff without capturing. The (?!...) bit looks ahead to make sure the following stuff doesn't match whatever '...' is. The '...' bit inside of (?:...) matches a single character so long as it's not the start of something that would match '\s*\(rev'.
The fourth field just picks up everything from '(Rev' to the end of the line.
In reply to Re^3: splitting lspci output
by GrandFather
in thread splitting lspci output
by rimmern
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |