Hi Ralph,
Find:
(?s)XXXXXXXXXX(.+?)XXXXXXXXXX
Replace:
YYYYYYYYY\1YYYYYYYYY
Some explanation:
(?s) means allow the dot (which is the regular expression wildcard character) to match at new lines.
(.+?) means capture one or more characters non-greedily.
\1 is the result of that capture.
For anything touching regular expression patterns you should check the excellent BBEdit's menu Help > BBEdit Help > Grep Reference.
HTH,
Jean Jourdain