Reputation: 3
I've looked at a lot of answers to this question but I never seem to get the correct text that I need.
I am trying to extract a group name from a string, then check if that group name appears in a modal when I try to delete that group
The string is "ABCDE 0
" where "ABCDE
" is the group name.
The group name can change from time to time, so does the number beside it. Basically what I want to do is to remove the space and the number after it so all that is left is the group name.
I've tried storedVars['LastGroup'].match(/\\d+/);
but I get the "0
" instead of "ABCDE
" when I run the test.
I've also tried storeEval "${LastGroup}".split("")[${number}]
but all i get is "A
"
I'm a newbie so I may be missing something but I'm not sure what it is. Please help.
Upvotes: 0
Views: 2820
Reputation: 4536
It should work:
storeEval "${LastGroup}".split(" ")[0]
Note - There is blank "space" in split.
Upvotes: 1