in reply to Creating spacers in regex match

Well, "anything" in a regexp is written as (?s:.), but it seems you want to match two two-hexit hex numbers. Which means you could write:
/16 03 01 [[:xdigit:]]{2} [[:xdigit:]]{2} 0b/

Replies are listed 'Best First'.
Re^2: Creating spacers in regex match
by ahuang14 (Novice) on Jul 08, 2011 at 15:18 UTC
    ah I got you. can you just explain what the xdigit means? I'm new to perl and I want to learn. How is this different than the ?s:.
      [[:xdigit:]] is a character class that matches a hex digit. See man perlrecharclass. (?s:.) matches any single character; (?s:.*) matches any possible string of characters.
        I tried the xdigit line you gave me and it didnt work.
        my $str = "06 03 01 0f 0e 0b"; if ($str=~ /06 03 01 [[:xdigit:]]{2} [[:xdigit:]]{2} 0b/){ print "hi"; }