I am new to regex and I want some suggestion for my code please. I have the following code in python:
import re
textToSearch = """
hello{
@hi {
I want this text
}
@hola {
I don't want this text
}
}
"""
regex= r'(?<=@hi {)[^}]*'
result = re.findall(regex,textToSearch)
print(result)
#Output = ['\n I want this text\n ']
What I want as a output is:
@hi { #everything in here }
including leading space and curly braces of @hi
I would appreciate any suggestion to solve this. Thank you.