Improve RegExp reliability