/ [A-Z]+ # WB \(\d+,\d+\) # (1,2) \s*=\s* # = (?: # start non-capturing group \d+\.\d+, # a float followed by comma \s*(\d+\.\d+),? # capture a float (followed by comma?) ) # end-group /gx