Parse text results from Tesseract.js

I’m completly new to OCR and tesseract.js. I’m trying to get datas from a card image like this one and store datas into specifics variables.

What i’ve done so far :

<script>
    Tesseract.recognize(
        'carte.png',
        'fra', {
        logger: m => console.log(m)
        }
    ).then((res) => res).then(({
        data
    }) => {
        console.log(data.text, typeof(data.text)); // returns type as string
    })
</script>

I get this in console :

=2 certi
_ NOM Prénom
Certificatn°: 1245644868
Catégorie: Décideur exploitation agricole
Service
æ" référent :
-
FranceAgriMer
 string 

I want to parse and store those datas like this :

  • name = “NOM”
  • firstname = “Prénom”
  • certificateNumber = “1245644868”
  • category = “Décideur exploitation agricole”
  • expirationDate = “Juin 2020”

Thanks in advance !