jeudi 2 avril 2020

Swift - Adresses using Regex

I am programming an Live Camera OCR but I have a problem.

I need to read the German adress line, live from the camera view (which already works) but the only problem I have is that it should read the complete address line, and not only single words.

So I would have adresses like this:

Heinrich-Göbbel-Strasse 5

Fataler Weg 7

Neue Str. 317

Sometimes it only showed the first word or it found nothing..

These are the patterns that I've used and tried so far:

[A-Za-zöäüÖÄÜ-]+[ ,.-]?[ ]?[ ,.-]?[A-Za-zöäüÖÄÜ-]+[ ,.-]?[ ]?[ ,.-]?[A-Za-zöäüÖÄÜ-]+[ ,.-]?[ ]?[ ,.-]?[0-9]*

(?x)(\w{3,12})[\ -./]?(\w{1,12})?(\d{1,3})?[\ -./]?(\w{1,12})(\d{1,3})?[\ -./]?(\d{1,3})

I am really new to regEx so I would really love if anyone could help me out.

Aucun commentaire:

Enregistrer un commentaire