@anonymous/EcstaticJadedIzuthrush
Python 2.7

No description

fork
loading
repl talk
(games)
Files
  • main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python
# Copyright 2014 Tomasz Wyderka <[email protected]>
##
import re

string  = "a--b"
pattern = r"[ab-]+"
#pattern = r"[-ab]+"
#pattern = r"[a-b]+"
#pattern = r"[a\-b]+"
flags   = 0 # re.DOTALL | re.MULTILINE

for m in re.finditer( pattern, string, flags ):
    print repr( m.group() ),
    print "from %d to %d" % m.span(),
    print "with groups: %s" % str( m.groups() ) 

print "String length: %d" % len(string)
Python 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.8.2] on linux