Complex regex patttern to select all users that are not part of a specific group -
i've been trying write regex selection pattern hour , can't wrap head around how regex works complicated patterns.
basically have list of around 20k users data looks this:
d3c80ef4-ae3c-43dc-8cf1-2dd44db19612: group: [] options: name: etcusername 7cacfa27-da32-49d0-8c6f-f1dced07e8bb: group: - duke options: name: username3 2b5e7795-fba5-4ae0-9479-a1d14f3e4678: group: [] options: name: username2 e7f8ef7e-0e58-4142-ba0f-763be65e55e3: group: - resident options: name: username1 now, want blacklist specific 'groups' being selected. let's use "resident" , "duke" examples, once can figure out regex ( or have figuring out :( ) can fill in rest of ranks want keep.
this regex came far, selects every line regardless of group :(
((?!resident))((?s).+?(name: )(\s)*\b) i think information need include here, i've been trying long , need move on this. if other information needed please ask in comments , surely update question information requested.
this matches guid name: skipping on excluded groups:
^ [0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}:\r(^(?! +- (resident|duke)).+\r)+? +name: .+\r
Comments
Post a Comment