slightly modified xregexp