0

I have the following log message:

"Record was found. Existing Id : 16786131-5d05-4545-92c6-3a24b92843bd Incoming Id : 16786131-5d05-4545-92c6-3a24b92843bd"

I'm using following regex to extract uuids from message:

\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b

What If I only want to extract uuid with prefix Existing Id :

How can I do that?

https://rubular.com/r/icNcb88Z5mO2TN

Mateusz Urbański
  • 6,497
  • 13
  • 56
  • 120

1 Answers1

1

something like \bExisting Id : ([a-f0-9-]+)\b

that is:

word boundary , literal string "Existing Id : " followed by >0 repetitions from the set (hex letters and digits and -) and then a boundary.

cms
  • 5,664
  • 2
  • 27
  • 30