I assume this is for Classification Rule Builder(CRB). @Wiktor's commented answer is okay, but you shouldn't need to include the \n
in the regex he provided. One thing his regex assumes though is that all of your existing keys have have all 9 values or at least placeholder colons for them. In my experience in practice this isn't always the case; historical data may have less because requirements were changed. If this is the case for you, then here is a slightly modified regex that @Wiktor provided:
^([^:]*)(?::([^:]*))?(?::([^:]*))?(?::([^:]*))?(?::([^:]*))?(?::([^:]*))?(?::([^:]*))?(?::([^:]*))?(?::([^:]*))?$
This will give you $1
through $9
for the values:
value1:value2:value3:value4:value5:value6:value7:value8:value9
$1 = value1
$2 = value2
$3 = value3
$4 = value4
$5 = value5
$6 = value6
$7 = value7
$8 = value8
$9 = value9
Or you can have empty ::
placeholders for them, e.g.
value1:value2::value4:value5::value7:value8:value9
$1 = value1
$2 = value2
$3 =
$4 = value4
$5 = value5
$6 =
$7 = value7
$8 = value8
$9 = value9
And it will also match the present values if you don't have the full 9 value string, e.g.
value1:value2::value4
$1 = value1
$2 = value2
$3 =
$4 = value4