Thursday 25 November 2010

regex review

Find the Amazon UK page listing Digital Cameras. Use View Source in your browser to examine the html for this page. How are the prices tagged?

Explain briefly how XSLT could be used to extract a table of prices from this page.

On the printouts provided, circle the (non-empty) strings matched by each of the following regular expressions. You can use a separate sheet for each expression.

[A-Z]+[0-9]+

[A-Z]+[0-9]+[A-Z]*

Can you write a regular expression that selects all the model numbers on this page and nothing else? Use the regular expression sandpit to check your answer – copy text from the web page to replace the Jabberwocky poem.

The Amazon page also has details of resolution (megapixels), zoom factor (e.g. 8x Optical) and screen size (e.g. 2.7 inch), but these are not tagged specially in the page source.

To tag them you would first have to find them. Use the regular expression sandpit to find three regular expressions – one for each data type – to find all occurrences of each of these three data types.

No comments:

Post a Comment