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

Day - 7 - Regular Expression - Assignment

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

Day - 7 - Regular Expression - Assignment

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

Day -7 (Regular Expressions) 10*5 =50

1. Write a Python program to check that a string contains only a certain set of
characters (in this case a-z, A-Z and 0-9)

2. Write a Python program that matches a string that has an a followed by zero
or more b's.

3. Write a Python program that matches a string that has an a followed by one
or more b's.

4. Write a Python program that matches a word at the beginning of a string.

5. Write a Python program that matches a word containing 'z'.

6. Write a Python program to search for numbers (0-9) of length between 1


and 3 in each string.

7. Write a Python program to find all five-character words in a string.

8. Write a Python program to remove everything except alphanumeric


characters from a string.

9. Write a Python program to concatenate the consecutive numbers in a given


string.

10. Write a Python program to replace all occurrences of a space, comma, or dot
with a colon.

You might also like