Question: Part 1: Create an HTML file called matcher.html. It may contain HTML, CSS, and/or JavaScript. Define an array of words. Test your code on the

Part 1: Create an HTML file called matcher.html. It may contain HTML, CSS, and/or JavaScript. Define an array of words. Test your code on the following list of words:

anyway

bone

cinema

cover

define

economy

eleven

eye

hesitate

key

majority

music

palace

potato

relax

royal

surely

typical

vocabulary

water

Use document.write to show the words to the user. Call prompt to allow the user to enter a regular expression pattern. Your code should then iterate over the array of words and report the matches. Report your shortest pattern, its length, and the number of words matched. Try to find a pattern that matches all words.

Part 2: Using matcher.html as a starting point, create a file called match2.html. Similar to above, it should support not one but two arrays of words. Again prompt the user for a pattern and report the matches in the first and second lists. Report your shortest pattern that matches all of the words in the first list but none in the second list. Include the length of the pattern, the number of matches in the first list, and the number of matches in the second one. Test using the following and report your results for each.

All of the following:

afoot

catfoot

dogfoot

fanfoot

foody

foolery

foolish

fooster

footage

foothot

footle

footpad

footway

hotfoot

jawfoot

mafoo

nonfood

padfoot

prefool

sfoot

unfool

None of the following:

Atlas

Aymoro

Iberic

Mahran

Ormazd

Silipan

altared

chandoo

crenel

crooked

fardo

folksy

forest

hebamic

idgah

manlike

marly

palazzi

sixfold

tarrock

unfold

All of these:

Mick

Rick

allocochick

backtrick

bestick

candlestick

counterprick

heartsick

lampwick

lick

lungsick

potstick

quick

rampick

rebrick

relick

seasick

slick

tick

unsick

upstick

None of these:

Kickapoo

Nickneven

Rickettsiales

billsticker

borickite

chickell

fickleness

finickily

kilbrickenite

lickpenny

mispickel

quickfoot

quickhatch

ricksha

rollicking

slapsticky

snickdrawing

sunstricken

tricklingly

unlicked

unnickeled

For this part, $ is not allowed. Match all of these:

fu

tofu

snafu

None of these:

futz

fusillade

functional

discombobulated

All of these:

abac

accede

adead

babe

bead

bebed

bedad

bedded

bedead

bedeaf

caba

caffa

dace

dade

daff

dead

deed

deface

faded

faff

feed

None of these:

beam

buoy

canjac

chymia

corah

cupula

griece

hafter

idic

lucy

martyr

matron

messrs

mucose

relose

sonly

tegua

threap

towned

widish

yite

Deliverables: Email matcher.html, match2.html, and your answers (see below) to me and our TA with the required email subject of regexp. In your answers include screen shots of the validation of the JavaScript in matcher.html and match2.html from http://beautifytools.com/javascript-validator.php. No errors or warnings are allowed, except for document.write can be a form of eval.

Part 1: pattern length # of matches

Part 2: pattern length # of matches in 1st list # of matches in 2nd list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!