0% found this document useful (0 votes)
8 views1 page

Assignment Report

Uploaded by

Boutchi TMN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Assignment Report

Uploaded by

Boutchi TMN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

a) ^([^a]*a[^a]*){2}[^a]*$

^ asserts the start of the string.

([^a]*a[^a]*){2} matches exactly two occurrences of 'a' surrounded by zero or more characters that are
not 'a'.

[^a]* matches zero or more characters that are not 'a'.

$ asserts the end of the string.

b) ^ab?$

^ asserts the start of the string.

a matches the character 'a'.

b? matches zero or one occurrence of the character 'b'.

$ asserts the end of the string.

c) [a-z]+-[a-z]+

[a-z]+ matches one or more lowercase letters.

- matches the dash character.

[a-z]+ matches one or more lowercase letters.

d) \b\w*y\w*\b

\b asserts a word boundary.

\w* matches zero or more word characters (letters, digits, or underscores).

y matches the character 'y'.

\w* matches zero or more word characters.

\b asserts a word boundary.

e) \b\d{1,5}\b

\b asserts a word boundary.

\d{1,5} matches a digit repeated between 1 to 5 times.

\b asserts a word boundary.

You might also like