On 03/02/2012 15:12, dongen wrote:
> I'm having some problem with expansion. The following is a
> contrived example of what's going wrong. I must be missing
> something obvious.
> 
>     \expandafter
>     \xdef\csname #1\endcsname ##1{%
>         \regex_match:nnTF{o}{o}{{0}{0}}{{1}{1}}
>     }
> 
> This defines some macro with the following definition:
> 
>     macro:#1->\regex_match:nnTF {o}{o}{{0}{0}}{{1}{1}}
> 
> I'd have thought the body of an xdef would be fully expanded
> (unless you put an explicit \noexpand in front of an expression).
> 
> Why doesn't the \regex_match expand? If there's any documentation
> I should read in order to understand this, please let me know where
> to find it.

All LaTeX3 functions are either fully expandable or engine-protected. In
this case, we are talking about protected functions: these are not
expandable. (In the documentation, expandable functions are marked with
a star.)
-- 
Joseph Wright