grep -oP '(?<=<div class="Message"> ).*?(?= </div>)' file
如果您的代码跨越多行,请尝试:
< file tr -d '\n' | grep -oP '(?<=<div class="Message"> ).*?(?= </div>)'