X509 Subject Formatting
Published Oct 18, 2019
Version 1.0Was this article helpful?
: The regsub try to match the largest pattern...
The first match string is:
London, City of", L=Bar, O=Foo, OU=TEST, CN="F5lab
The second is
local"
So you have to force stoping at the first "... replace the .* with [^"]*
The problem with this expression is it will also match this string:
f", L=Bar, O=Foo, OU=TEST, CN="
This expression seems to work with your example:
% set subject [regsub -all {([a-zA-Z]+ ?= ?"[^"]+),([^"]+")} $subject "\\1--COMMA--\\2"]
C=GB, ST="London--COMMA-- City of", L=Bar, O=Foo, OU=TEST, CN="F5lab--COMMA-- local"