switch to regex instead of indexOf