Regex 101 Answer I10 - Extract repeating hex blocks from a string

Regex 101 Exercise I10 - Extract repeating hex blocks from a string

Given the string:

PCORR:BLOCK=V5CCH,IA=H'22EF&H'2354&H'4BD4&H'4C4B&H'4D52&H'4DC9;

Extract all the hex numbers in the form “H’xxxx”

*****

You can match the hex digits with:

H'(?<Values>[0-9a-fA-F]{4})

Like our last example, you can call Match() multiple time, use Matches(), or do it in a single call with:

(H'(?<Values>[0-9a-fA-F]{4})&)+