This is my string, I want my regex to return "bash" at group 1 and "585602" at group 2 (the Pid value)
Name: bash
Umask: 0022
State: S (sleeping)
Tgid: 585602
Ngid: 0
Pid: 585602
PPid: 585598
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000
FDSize: 256
Groups: 150 962 970 985 987 990 996 998 1000
NStgid: 585602
NSpid: 585602
NSpgid: 585602
NSsid: 585602
VmPeak: 8708 kB
VmSize: 8708 kB
...
what I have now is
Name:\t *(.*)\n(.|\n)*?Pid:\t *(.*)\n
Unfortunately, I'm seeing that the second matched group is the single newline before the P of "Pid", and the third one is the Pid value. I sense the problem is in the (.|\n)
part of the regex, but if I remove the parentheses then it groups a lot of other stuff that I don't want. How would I go about having only bash and the pid value as groups?