APM variable assign examples
Updated Jun 06, 2023
Version 2.0Was this article helpful?
@Joe Lupo, try this code:
set subject [split [mcget {session.ssl.cert.subject}] ",="];
foreach {name value} $subject {
if {[string trim $name] eq "CN"} {
return [join [lrange [split [string trim $value] "."] 0 1] "."];
}
}
the CN is split to a list with dot as separator (
split text "."
)... then the first 2 words (lrange list 0 1
) are converted to string with dot between list items (join list "."
) ...
if there is no dot in CN, the whole string will be returned.