for python3.3, changed "fullmatch" to "match"

also re-did string from weight function