human
how to return a match substring in.
assistant
Here is a Python function to return a match substring

import re

def match_substring(string, pattern):
    """Returns a match substring in `string` with `pattern`.

    :param string: the string to search
    :type string: str
    :param pattern: the pattern to search
    :type pattern: str
    :returns: the match substring in `string` with `pattern`.
    :rtype: str
    """
    return re.findall(pattern, string)

# Enter the string
string = "hello world"

# Enter the pattern
pattern = "world"

# Calling the function
print((match_substring(string, pattern)))

#Example Output
# ['world']

#Remember to inspect code for bugs.