Which expression should you insert into each function?

DRAG DROP
You are validating user input by using JavaScript and regular expressions.
A group of predefined regular expressions will validate two input fields:
An email address in a function named validateEmail (for example, [email protected])
A nine-digit number that allows optional hyphens after the second and fifth character in a
function named validateSSN(for example, 555555555 or 555-55-5555)
You need to use the correct expression to validate the input.
Which expression should you insert into each function? (To answer, drag the appropriate
regular expression statement to the correct location. Each regular expression statement may
be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)

DRAG DROP
You are validating user input by using JavaScript and regular expressions.
A group of predefined regular expressions will validate two input fields:
An email address in a function named validateEmail (for example, [email protected])
A nine-digit number that allows optional hyphens after the second and fifth character in a
function named validateSSN(for example, 555555555 or 555-55-5555)
You need to use the correct expression to validate the input.
Which expression should you insert into each function? (To answer, drag the appropriate
regular expression statement to the correct location. Each regular expression statement may
be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)

Answer:

Explanation:



Leave a Reply 11

Your email address will not be published. Required fields are marked *

11 + 14 =


Vas

Vas

Thank you for the questions, they helped me get certified today. There were lots of new questions, but this site helped me a lot.

David

David

Hi.

I will present the 70-480 test on next Friday. What new questions added?

I am nervous.

Thanks!

Will

Will

The correct RegExp for SSN is:

var ssnPattern = /^[0-9]{3}\-?[0-9]{2}\-?[0-9]{4}$/;

Explanation:
^: Begins with
[0-9]{3}: 3 characters between 0 to 9.
\-?: Zero or One Dash character
[0-9]{2}: 2 characters between 0 to 9.
\-?: Zero or One Dash character
[0-9]{4}: 4 characters between 0 to 9.
$: Ends with

—————————————————————–
Simple sample web page for testing a regex
—————————————————————–

REGEX TEST

.Success {color: Green;}
.Failed {color: Red;}

Enter Text:

var btnRegex = document.getElementById(“btnRegex”);
btnRegex.onclick = function () {

var txtboxTest = document.getElementById(“txtTest”);
var strTest = txtboxTest.value;
var divResponse = document.getElementById(“divResponse”);

var re = /^[0-9]{3}\-?[0-9]{2}\-?[0-9]{4}$/;
if (strTest.match(re)) {
divResponse.innerHTML = “Match!”;
divResponse.className = “Success”;
}
else {

divResponse.innerHTML = “Not a match!”;
divResponse.className = “Failed”;
}
}

Mike

Mike

Just confirmed this, none of the options here would correctly match a SSN. I put your solution into regex101 so people can play with it and learn more about regex here: https://regex101.com/r/dwm7mT/1

Foor Manchu

Foor Manchu

Just passed 70-480 after 3 times!!! Passed with a score of 900!!!

Around 15%-18% new questions.

Pay close attention to questions on these points:
– about priority when there is multiple event (div inside div and each dive has a click event)
– css priority (div.class or #id wich give color)
– overflow horizontal or vertical

Dumps from this AIO site are not enough for 100% passing. I also learned the premium PL dumps (247Q) here: http://www.passleader.com/70-480.html (recommend!)