Change how regex modifier works and add new tests