1) Write a regular expression for each of the following (1 point each)

  1. Matches "hello", "chello", and "jello"
  2. Matches "bal", "ball", and "balloon"
  3. Matches a string containing 5 word characters, followed by 1 underscore and 4 digits
  4. Matches any 5 digits followed by a dash, then another 4 digits
  5. Matches "pot", "bot", "boot", and "boooooooooooooooooot"
  6. Matches any 7 letter string without "z","q", or "x"
  7. Matches any 3 digit number without "0","1" or "5" followed by an underscore, 1 or more letters, another underscore and 5 letters
    (example: 246_hello_world)
  8. Matches any html tag without an attribute
  9. Matches an honorific (Mr, Mrs, Ms, Dr) followed by a space, and Uppercase letter, then 0 or more letters followed by another space, then an Upper Case letter followed by 0 or more letters.
    (example: Mr. Jeremy Anderson)
  10. Matches any 6 digit hex color code or 3 digit color code abbreviation value

2) Write a regular expression checker (5 points)

Create a web page (regEx.php) with a form with 2 fields which posts to itself.

  1. An element for you to enter text
  2. An element for you to enter a regular expression

When the form is submitted, it must call a function "checkRegEx()" which takes 2 arguments, the string and the regular expression. It must then use preg_match to check if the string entered matches the pattern in the regular expression. The function must show the string tested, the regex used, and the result (whether it is a match or not). (Hint: You may need to use the stripslashes() function.)

3) Add-a-link page validation - 5 points

From the add-a-link in Homework 8, write an regular expression to validate the URL the user inputs. The regular expression must check for and allow the following:

Extra Credit

4) Add-a-link page formatting - 10 points

Modify your add-a-link display page to, in addition to displaying the title entered by the user, to go and check the URL entered for the title on that page. (i.e. the text between the <title> and </title> tags.) and display that as well.

Each link on your page should be displayed as follows:

If there is no title on the page, Use the Title entered by the user for the title link instead and don't display the "User Title" information line.

You may add other information as needed, but it is not required (i.e. The user who submitted the link, the date, etc)

5)Grab meta tags

For number 4 above, modify the code to grab the information from the meta tag for description (if the page has it), and change the display to include the that text instead of the user submitted text with a link called "user comments" below which links to a page showing the comments entered by the user for that page.

Hints:
NEXT
PREVIOUS
Master Index