0 out of 464 challenges solved

Match String with 'a' to 'b'

Write a Python function `match_a_to_b` that takes a string as input and checks if it matches the following pattern:

- The string contains the letter 'a'.
- The letter 'a' is followed by any sequence of characters (including none).
- The string ends with the letter 'b'.

Return `True` if the string matches the pattern, otherwise return `False`.

#### Example Usage
```python [main.nopy]
match_a_to_b("aabbbb")  # True
match_a_to_b("aabAbbbc")  # False
match_a_to_b("accddbbjjj")  # False
```

#### Constraints
- The input will always be a non-empty string.
- The function should be case-sensitive.
import re

def match_a_to_b(text):
    """
    Check if the input string matches the pattern: starts with 'a', followed by any characters, and ends with 'b'.

    Args:
        text (str): The input string to check.

    Returns:
        bool: True if the string matches the pattern, False otherwise.
    """
    # Define the pattern
    pattern = ''  # TODO: Define the regex pattern
    # Use re.search to find a match
    return bool(re.search(pattern, text))