#something about regular expression
regarding compile
same meaning.
- with compile
.py
prog = re.compile(pattern)
result = prog.match(string)
- without compile
.py
result = re.match(pattern, string)
If you want to check the regex instantly, use
reg tester.
##Example for reminder
###time with timezone.
1999-04-13 15:00:00+09:00
.re
^\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2}\+\d{2}:\d{2}$
^\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2}(\+|\-)\d{2}:\d{2}$
###number expression.
2999.5982
.re
^[0-9]+$ # integer, only number no unicode number
^\d+\.\d+$ # real number, number and unicode number
^[-]?¥d+(¥.¥d+)?$ #real, plus/minus, number and unicode
^[-]?[0-9]+(¥.[0-9]+)?$ #real, plus/minus only number,
##special character requiring escape.
, *, +, ., ?, {}, (), [], ^, $, -, |, /