Mar-13-2019, 01:06 PM
Assume that a poem is given. Write the regular expressions for the following:
If the pattern has characters 'ai' or 'hi', replace the next three characters with *\*.
poem ='''
If I can stop one heart from breaking,
I shall not live in vain;
If I can ease one life the aching,
Or cool one pain,
Or help one fainting robin
Unto his nest again,
I shall not live in vain.'''
If the pattern has characters 'ai' or 'hi', replace the next three characters with *\*.
poem ='''
If I can stop one heart from breaking,
I shall not live in vain;
If I can ease one life the aching,
Or cool one pain,
Or help one fainting robin
Unto his nest again,
I shall not live in vain.'''