Improved regex; added support for S|W identifiers