Power Automate: Retrieving specific data from email body

Trying to automate a workflow in which issues with products and the handling of the issues are logged and tracked in an Sharepoint list, all based on emails arriving in a shared mailbox. Initial email arrives in a shared mailbox. In the subject and the body of the email is a reference number (internal ticket number) that needs to be saved in the Sharepoint list. Next an email arrives from an external party referencing the internal ticket number and sharing the external ticket number from that external party in the body of that email. External reference number needs to be saved in Sharepoint list as well for the relevant internal ticket number. This is part of the whole flow. Trying to retrieve the ticket numbers from the internal and external emails. Tried this with GPT prompt action in Power Automate but that does not seem to be a stable solution in the sense that GPT prompt does not seem to recognize the entities. There are several videos where people use a string of compose actions to retrieve data from email body, but I am worried that the reference numbers are not consistently at the same spot in the emails (which is required if one uses the compose actions solution if I am not mistaken?). Can somebody help?