Yes, since with the string ["/" " "], the regexp /(?&lt;delimiter&gt;".+"|NIL) (?&lt;mailbox&gt;.+)/ will greedily matched the delimiter as ["/" "] and then matched the mailbox as ["]. (I use square brackets instead of quotes to avoid confusion)