Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pattern = "(([ef]|([gh]d*(ad*[gh]d)*b))d*b([ef]d*b|d*)*c)"
- matches = re.finditer(pattern, string)
- for match in matches:
- print "(%d-%d): %s" % (match.start(), match.end(), match.group())
- Traceback (most recent call last):
- File "code.py", line 133, in <module>
- main(sys.argv[1:])
- File "code.py", line 106, in main
- for match in matches:
- KeyboardInterrupt
- ddddddeddbedddbddddddddddddddddddddddddddddddddddd
- ddddddeddbedddbdddddddddddddddddddddddd
- ddddddeddbedddbdddddddddddddd
- ([ef]|([gh]d*(ad*[gh]d)*b))d*b
- |
- (([ef]|([gh]d*(ad*[gh]d)*b))d*b([ef]d*b|d*)*c)
- (([ef]|([gh]d*(ad*[gh]d)*b))d*b([ef]d*bd*)*c)
- import re
- string = "ddddddeddbedddbddddddddddddddddddddddddddddddddddd"
- pattern = "(([ef]|([gh](a[gh])*b))b([ef]b)*c)"
- matches = re.finditer(pattern, re.sub("d+", "", string))
- for match in matches:
- print "(%d-%d): %s" % (match.start(), match.end(), match.group())
Add Comment
Please, Sign In to add comment