Is there a way to format the output monitor text by regex?

My monitor element:
November 8, 2022—KB5019959 (OS Builds 19042.2251, 19043.2251, 19044.2251, and 19045.2251)

I would like to format the output text to:
November 8, 2022 (19045.2251)

I tried (\w+ \d+, \d+).*(19045.\d+) and (\w+ \d+, \d+)(?:.*)(19045.\d+) both didn’t work.

A direct formatting isn’t possible. But one can match certain parts from text to extract them out. Can you try using something like the following?

(\w+ \d+, \d+)|\(|(19045.\d+)\)

1 Like

Oh! it did work. In this case, the vertical bar | can join three matching texts with a whitespace. Have to use /g global mode

1 Like