Given is a string variable elementOne.
def elemenOne = 'AB_CD_EF_GH'
The challenge is to extract only the 'AB', the first part of its value, only that which precedes the first underscore symbol (counted from the left to right).
I have written a code:
def elementTwo = (element_one =~ /^.*(?=(_))/)[0][0]
but it extracts 'AB_CD_EF' instead of only 'AB'.
How should I modify my code, in order to extract only 'AB' part from 'AB_CD_EF_GH'?
Thank you!