RegEx capture groups

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ceilingdoor
:warning: Old Version Published before Godot 3 was released.

I have this regular expression:
enter image description here

I want it to extract all ABs from the string but it gives this:
enter image description here

How do I get it to work? Will regular expressions do the trick in this case at all?
Most likely I just fail to understand the concept of regular expressions but I’ve tried several patterns and none of them have worked so far.

:bust_in_silhouette: Reply From: Brice

find() stop at the first match and returns the start index:

var i = 0

while r.find("ab aa bb, ab, ab", i) >= 0:

	i = r.get_capture_start(1) + r.get_capture(1).length() 	
    prints(r.get_capture(1),  r.get_capture_start(1))

gives:

#ab 0
#ab 10
#ab 14