[update] using regex instead of indexOf, fixed testing