new extraction algorithm using regex