import re


def filter_abstract(s):
    """
    Some abstracts have metadata tags that should not be displayed in public
    views. If present, only the text between {AbstractBegin} and {AbstractEnd}
    should be displayed.
    """

    match = re.search('\{AbstractBegin\}([\w\s\W\S]*)\{AbstractEnd\}', s)
    if match:
        return match.groups()[0].strip()
    return s