/^([\+-])?P(\d+W)?(\d+D)?[T]?(\d+H)?(\d+M)?(\d+S)?/

Notes