If you want to get the engine with status hold
, try something like this:
regexp -- {([^\}[:blank:]]+?)\s*?\{status hold} $data - engine
Your engine will be in the $engine
variable.
([^\}[:blank:]]+?)
will match non }
or blank characters (this is where the engine name is matched) and stored into the first submatch, engine
, provided the next parts match, meaning any spaces \s*?
and {status hold
.
If you have multiple engines you might try something like that:
set engines [regexp -all -inline -- {[^\}[:blank:]]+?(?=\s*?\{status hold)} $data]
Where $engines
will be a list of all engines on hold
.
Here, I'm using a positive lookahead instead of capture groups because -all -inline
will return a list of all matches and sub-matches. The regex is about the same, with the first pair of ()
removed and the second part wrapped around (?= ... )
(which is the positive lookahead).