what does below code do ?? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

what does below code do ??

abcdef1abcdef1 Posts: 2Member
Hi,

I have below code :

my($abc) = "fred3hello";
$abc =~ /^[^d]{2,4}<([^>]+)>d?1$/;

if (defined($1)) {
print "$1
";
} else {
print "not found
";

}
}

What is the code doing ?? what function of the regular expression

$abc =~ /^[^d]{2,4}<([^>]+)>d?1$/;

??

Comments

  • TrizenTrizen Posts: 5Member
    ^ - beginning of the string
    [^d]{2,4} - 2 to 4 characters not containing a digit
    ([^>]+) - 1 will be one or more characters until '>'
    d? - zero or one digit
    1 - match word '1' (hello)
    $ - final of the string

    What is the code doing?
    - Matches a string.
  • TrizenTrizen Posts: 5Member
    This post has been deleted.
Sign In or Register to comment.