Project 1
This project tests your ability to write regular expressions and use them in Perl scripts.
Please write the following:
- a regular expression that matches a floating point number. For example, it should match -12.5,
+10, 0.12, -.10, etc, but it should not match 10.2.1 or .2.
- a regular expression that matches a string containing a Windows 2000 file name. Let's assume that a file (or a
folder) name can contain up to 256 characters that include any letters, digits, space symbols, tilde symbos, carrots,
dashes, underscore symbols, and dollar signs. Any folder or file can have a number of extensions that separated from
the file/folder name or previous extension with a backslash symbol. For example, it should match
C:\Documents and Settings\hidden.user\Application Data\desktop.ini
but it should not match
h:\.access.ini
because a file name cannot be empty.
- a regular expression that matches an HTML opening tag, all its attributes, the corresponding closing tag, and the
text between the opening and closing tags. For example, for the following string
<div align=center width=90%>This is <i>italic</i> text</div>
your script should print:
Tag name: div
Attribute: align value: center
Attribute: width value: 90%
Text: This is <i>italic</i> text
For each regular expression write a script that tests a string $str defined in it for a match.
This project is due by 11:59pm on Tuesday, February 3, 2004.