I have a string that I am trying to create a group of only the items that have commas. So far, I am able to create a group, what I'm trying to do is ensure that the string contains the word nodev. If the string doesn't contain that word, a match should show, otherwise, the regex should not match anything.
String:
"/dev/mapper/ex_s-l_home /home ext4 rw,exec,auto,nouser,async 1 2"
Regex that matches the comma delimited group:
([\w,]+[,]+\w+)
I've tried this regex but with no luck:
(?!.*nodev)([\w,]+[,]+\w+)
I'm using https://pythex.org/ and am expecting my output to have one match that contains "rw,exec,auto,nouser,async". This way I plan on appending ,nodev to the end of the string if it doesn't contain it.
Looking for a regex only solution(no functions)
string.split()[3]enough?