Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- str = "!!!!!!!!!Haha!!!"
- #[' Haha ']
- def sudo_strip(string, arg2 = ' '):
- stripRegex = re.compile(r'{0}+(.*){1}+$'.format(arg2, arg2))
- mo = stripRegex.findall(string)
- print(mo[0])
- s2Regex = re.compile(r'(.*)' + re.escape(arg2) + r'+')
- om = s2Regex.findall(mo[0])
- print(om[0])
- s3Regex = re.compile(r'(.*)' + re.escape(arg2) + r'+')
- ro = s3Regex.findall(om[0])
- print(ro[0])
- sudo_strip(str, '!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement