Excluding Characters

Practice

Copy both the Match and the Exclude set of test strings from each exercise below into regexpal. Using what you've learned so far, create a regular expression that will match all of the strings in the Match set and exclude the ones in the Exclude set.

1 )

Match:

foxes
jumping
dogs

Exclude:

aaaaa

2 )

Match:

34522
72379

Exclude:

1234k
5784k
5784k

3 )

Match *only* the commas:

pears,
apples,
cherries,
oranges,

4 )

Match only the text character strings from each line ('html', 'head', etc):

<html>
<head>
</head>
<body>
<div>
</div>
</body>
</html>

0:00

You can exclude any character or
characters from a match.

0:04

This can be useful for
matching text between delimiters.

0:08

For comma separated values, for example,

0:11

we could match any character that is not
a comma to pull delimited values out.

0:16

To match any character,

0:18

except a target character, we'll use
a character set that starts with caret.