Help with Parsing text

I’m trying to parse some data in Bubble and I’m struggling.

I’m trying to parse a string to get a value from it. As a simplified version, I’ve got the following string: QQQQJohnYYY25QQQQDavidYYY22QQQQMaryYYY84QQQQ

If I type ‘John’ into an input, I want to return 25, if I type ‘David’ I want to return 22 etc.

I thought that ‘extract with Regex’ was the best option here. I tried the following Regex pattern:


If I enter ‘John’ in Input A, I thought this would extract the characters after ‘John’ and before the first QQQQ (i.e. 25), but it returns the characters between ‘John’ and the LAST ‘QQQQ’, which is ‘25QQQQDavidYYY22QQQQMaryYYY84’

Can anyone point me in the right direction?

Here is an app I built to test this.