Regex 101 Exercise 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”
Comments
Anonymous
March 06, 2006
I am not sure what the meaning is of this post, but am I allowed to post my solution? Or are u going to explain the solution later on regardless of comments? Because I am not really sure what the general idea is of your excersizes. Don't get me wrong here, I love Regex, I like puzzles like this! :-)Anonymous
March 07, 2006
In any case feel free to delete my submission if it's not submissable.
(?<HexNumbers>H'w{4})
I always create my Regex in C# with RegexOptions.ExplicitCapture included, so that's why I included the named group idenitifier.Anonymous
March 07, 2006
(H'[0-9A-Fa-f]+)
or
(H'[0-9A-Fa-f]{4})
depending on whether hex numbers are specified to have four digits (hexits) or whether they all just happened to have four digits in the sample string
I've never seen H' used as a hex indicator before... I have seen 0x, though. Here's a version that looks for that:
(0x[0-9A-Fa-f]+)Anonymous
March 07, 2006
TrackBack From:http://sheva.cnblogs.com/archive/2006/03/08/345195.htmlAnonymous
March 08, 2006
I was also slightly confused by the title of the post. My definition of repeating and your differ apparently. In any case, I propose a solution to your title question -
Given: PCORR:BLOCK=V5CCH,IA=H'22EF&H'2354&H'4BD4&H'4C4B&H'4D52&H'4C4B&H'4DC9&H'2354;
Regex: (?<Hex>H'[a-fA-F0-9]{4})(?=.*?k<Hex>)
That will find repeating blocks (i.e. blocks that are exactly the same; in the example case H'2354 and H'4C4B).Anonymous
March 14, 2006
Regex 101 Exercise I10 - Extract repeating hex blocks from a stringGiven the string:
PCORR:BLOCK=V5CCH,IA=H'22EF&amp;H'2354&amp;H'4BD4&amp;H'4C4B&amp;H'4D52&amp;H'4DC9;...Anonymous
June 07, 2009
PingBack from http://greenteafatburner.info/story.php?id=2285Anonymous
June 09, 2009
PingBack from http://quickdietsite.info/story.php?id=4003