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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.