jd1378 / otphelper

open-source application that can copy OTP and codes from notifications automatically for you
GNU Affero General Public License v3.0
424 stars 31 forks source link

Copying wrong number from notification #133

Open TeamMasse opened 5 days ago

TeamMasse commented 5 days ago

Ich got a notification: "222222 ist der Google Pay Aktivierungscode für deine Trade Republic Karte Endziffer-0000. Dieser Code verliert seine Gültigkeit nach 5 Minuten. Wir werden Sie niemals bitten, diesen Code zu teilen. 222222 ist der Google Pay Aktivierungscode für deine Trade Republic Karte Endziffer-0000. Dieser Code verliert seine Gültigkeit nach 5 Minuten. Wir werden Sie niemals bitten, diesen Code zu teilen."

The code I need is the 222222 but it triggered on code anf copied 0000. So it would be nice to be able define regex that ignores the next numbers/OTP but not the whole notification. So I could block ending digits so it ignores 0000 and recognizes the 222222 afterwards.

jd1378 commented 4 days ago

It's a little harder than that what you suggest is hard, because the capture has some sort of ignore mechanism built into it already but is not straightforward to use even by myself (I'm mostly relying on tests), and I cannot think of a way that it can be added to the current regex functionality

however I guess it may be possible to resolve this issue for everyone without introducing such an option, but I currently don't have much time to experiment with it

I would be happy if you could try stuff and tell me the result (if you are familiar with android development)

jd1378 commented 2 days ago

hmmm, I have an idea which I'll try when I have some time the idea is to create a cleanup regex (there is already one for domains) and expose it in the settings, which will be then used to cleanup the text before detection regex is run this should probably be the best course of action in which we can also help everyone and open up more possibilities for other kind of texts as well.