My way of doing this is using a text prompt and OpenAI:
Given an input like this:
"{I}"
Can you return a JSON structure of all phone numbers and emails in the input?
A sample structure would look like this:
{
"phone": "+123456789,+123456790",
"email": "example@gmail.com,example2@gmail.com"
}
Please return just the JSON and nothing else.
notalk;justgo.
Then you can query the JSON to return the final strings.