Given I have a string
Teacher: ID: 123 Something: Something Name: ABC Age: 40 Student1: Name: XYZ Age: 12 Student2: Name: ABC
I want to check using regex that the first Name:
after Teacher
corresponds to ABC
I have tried to do using lazy
/(Teacher:(.*?)Name: ABC)
but that would return true even if
Teacher: Name: EFG Age: 40 Student1: Name: XYZ Age: 12 Student2: Name: ABC
because it will then take the larger string.
EDIT: added try and made more generic