For Perl Language Problem: For each of the following, write one value for the va
ID: 3846492 • Letter: F
Question
For Perl Language Problem: For each of the following, write one value for the variable on the left that will result in a successful regular expression match: a) $country =~ /ia$/ I.e., if $country is ________________, this regular expression match would resolve to true. $country = __________________ b) $poss =~ /'s$/ $poss = ___________________ c) $var1 =~ /[AaEeIiOoUu]{2}/ $var1 = _________________ d) $var2 =~ /^.{1,3}$/ $var2 = _________________ e) $pin =~ /^[0-9]{4}$/ $pin = _________________ f) $hecks =~ /[A-F0-9][A-F0-9]+/ $hecks = _________________ g) $someone =~ /Bu(bb|dd)(a|y)/ $someone = _________________
Explanation / Answer
a) $country =~ /ia$/
I.e., if $country is ________________, this regular expression match would
resolve to true.
$country = ________"india"__________ //countries ending with 'ia' will be true
b) $poss =~ /'s$/
$poss = ________"india's"___________ //contries ending with "'s" will be true, plural
c) $var1 =~ /[AaEeIiOoUu]{2}/
$var1 = _______"AbEa"__________ // atleast 2 characters, and if 2 vowels are adjacent to each other will be true
d) $var2 =~ /^.{1,3}$/
$var2 = ________"sas"_________ //any characters within range 1-3 will becomes true
e) $pin =~ /^[0-9]{4}$/
$pin = ________"3212"_________ //4 numbers exactly
f) $hecks =~ /[A-F0-9][A-F0-9]+/
$hecks = ________"AK47gun"_________ //combination of capital letters and numbers + any characters
g) $someone =~ /Bu(bb|dd)(a|y)/
$someone = _______"Buddy"__________ //will becomes true if string starting with "Bu" followed by (bb or dd) and ends with (a or y)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.