Hello again good fellows :)
I have been trying to read up on regex especially when it comes to matching any repeating characters. What I am trying to do is find repetitions of 0A-9F that repeat themselves in 2 byte and 4 byte and 8 byte occurences. I have converted the hexadecimal to a literal string (eg - 0xaa 0xbb 0xcc 0xdd is $string aabbccdd11223344)
Here is a small example. Say for instance I have 64 bytes and I want to scan it for any repeating instances of hexadecimal characters between 0a-9f:

whats in the $string: 0a0a0a0a0b0b0a0a0c0c0c0c0c0c0c0c 1f1f2b2b2b2b3e3e7b7b7b7b7b7b7b7b 8f8f8f8f8f8f8f8f6c6c4b4b4b4b3f3f 9d9d0f0f0f0f0f0f0f0f3a3a2e2e2e2e
I am wanting it to match any repeating characters, the above is just an example. i will be working with files less than a few MB at most and i think i almost have it, but i am a little confused as how to setup the regex to accomplish this. This is what i have so far:

$string =~/\d{2,4,8}/\/[0-9a-fA-F]/; or $string =~/\w{2,4,8]/\/[0-9a-fA-F]/;

I am not sure how to setup the regular expression. I know the first part tells it to match digits of characters, but the way I have converted it it will print whatever is at the offset(0x1F2A will print as 1f2a in console), so I am pretty sure I need to be matching words.
All in all I want to be able to match any character that repeats itself in sets of 2 bytes/4 bytes/8 bytes. I feel that i am close, but still no cigar. Could anyone be so kind as to help me out just a little? :)

In reply to matching characters and numbers with regex by james28909

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.