Hi
This expression:
 replace("aaaa bbbbbbbb ddd ",'(.{6,15}) ','$1@')

results in
[FORX0002] Invalid pattern: 'Illegal quantifier, lower > upper bound: {6,1}'.

Could it be that S{n,m} is only accepting single digit n and m?

This causes http://stackoverflow.com/questions/3767452/xquery-word-wrap to wildly overwrap.

Regards
/Andy