-3

I'm having a hard time pulling out just the 1069 value using regex. I think I might be trying to use unsupported features to make it worse.

Q1: Would someone be able to let me know what regex would be needed to pull the numbers the 4th and 5th colons (value of 1069)

Q2: How to pull the items after the 6th colon? (value of 2929)

sample text:

diamond:dev:liquid:beta:1069:zone:2929
Ali Razeghi - AWS
  • 722
  • 1
  • 6
  • 19

1 Answers1

-1

Answer 1: How to get value between 4th and 5th colons:

(?>[^:]+:){4}([^:]+)

Try at regex101

Answer 2: How to get value after the 6th colon:

(?>[^:]+:){6}([^:]+)

Try at regex101

Note: You can replace + with * to handle cases like ::::2: (empty between colons).

namgold
  • 1,009
  • 1
  • 11
  • 32