I am trying to capture GPA with regex in Python. For example, I want to capture just 3.75 for both lines. The word GPA could be at the beginning or end of 3.75.
GPA 3.75 / 4.0
3.75 / 4.0 GPA
((?:gpa[ :]+)(\d\.?\d{0,2})(?:[/\d\. ]{0,6})?)|((\d\.?\d{0,2})(?:[/\d\. ]{0,6})? ?(?:gpa))
Here is my attempt. It works but I would like to know if there is a way not to repeat the yellow parts. They are exactly the same.
You can see more examples here. Thanks!
