<s>[INST] import json
import re

# Function to process the text
def process_text(text):
    # Define the regular expressions for the words to be removed
    words_to_remove = ['^hello', 'world$']
    for word in words_to_remove:
        text = re.sub(word, '', text, flags=re.IGNORECASE)
    return text

# Read the json file
with open('data.json') as f:
    data = json.load(f)

# Process each text in the json data
for item in data:
    item['text'] = process_text(item['text'])

# Write the processed data back to the json file
with open('data.json', 'w') as f:
    json.dump(data, f)

The code above modifies the text of each item in a JSON file by removing words that match certain regular expressions. However, it doesn't work as intended because it doesn't remove words properly. The issue lies in the way the regular expressions are defined. How do you fix this issue?[/INST]