Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex problem when starting with 0 or +. #54

Closed
Babag63 opened this issue May 18, 2024 · 12 comments
Closed

Regex problem when starting with 0 or +. #54

Babag63 opened this issue May 18, 2024 · 12 comments

Comments

@Babag63
Copy link

Babag63 commented May 18, 2024

Hi everyone and thanks for your awesome app !

I'm trying to block all numbers starting with 09 48 which are authorized commercial numbers in France so I tried this in regex : 0948.* as suggested in the readme.md but when I click on test and try a number such as 09 48 56 45 23, it isn't blocked.

Then I did further investigation and it seems that every regex starting with 0 doesn't work while other numbers do (something like 01.* or even 0.* doesn't work).

Finally I thought that I may not need to block numbers beginning with 0948 but +33948 instead as +33 is the local phone indicator for metropolitan France so I put \+339.* in regex field and tried the "number" +33934567890 and it still isn't blocked.

I think the app is the problem as I granted all the permission for it and it works for numbers like 1234567890 when I put 12.* in the regex field and tools like a regex visualizor don't show things differently when it starts with 0, 1 or even a +.

I'm a beginner in regex so I really hope I'm not the problem but I'll be glad to help you solve this if I can !

@aj3423
Copy link
Owner

aj3423 commented May 18, 2024

Since v1.5, the matching logic ignores the leading zeroes, and the + sign, the regex should be 948.*, without the leading 0 or +.
As described in the balloon tooltip:
image

Seems I really need to note this in readme, thanks for the feedback.

@bb1a2
Copy link

bb1a2 commented May 18, 2024

@aj3423 Or maybe apply the same stripping rule to the test string

@aj3423
Copy link
Owner

aj3423 commented May 18, 2024

@bb1a2 The stripping of these characters does apply to the test string, I just verified it again and it works.

@bb1a2
Copy link

bb1a2 commented May 18, 2024

Then why is the test call allowed? I am confused.

@aj3423
Copy link
Owner

aj3423 commented May 18, 2024

@bb1a2 Can you show me a test case? I tested with rule 400.*, and Tested with number +400111/0400111, both blocked by this rule.

@bb1a2
Copy link

bb1a2 commented May 18, 2024

I didn't try it myself. I went by the multiple issues raised. Isn't that what issue author is facing?

I tried this in regex : 0948.* as suggested in the readme.md but when I click on test and try a number such as 09 48 56 45 23, it isn't blocked.

@aj3423
Copy link
Owner

aj3423 commented May 18, 2024

Oh, now I understand, you mean remove the 0s in the rules as well.

@bb1a2
Copy link

bb1a2 commented May 18, 2024

Keep them for visuals (not to confuse the first-time user). But for all three (rule, test, actual call), apply the same treatment.

@aj3423
Copy link
Owner

aj3423 commented May 18, 2024

That's a good idea, thanks. I think it's better to solve it in the first place when editing rules, if there is leading 0 or +, show some yellow warning below.

@bb1a2
Copy link

bb1a2 commented May 18, 2024

That can work.

@Babag63
Copy link
Author

Babag63 commented May 18, 2024

Thanks for all your answers and the solutions proposed.
Really sorry for not having seen the balloon tooltip.
So to match a number starting with 0948 or +33948 finally I think I'll to do something like (33|)948.* as the 0 and + will be skipped anyways (if I understood your messages correctly).
Thanks again for your responsiveness.

@aj3423
Copy link
Owner

aj3423 commented May 18, 2024

(33|)948.* should work.
New error prompt has been added in tag latest.

@aj3423 aj3423 closed this as completed May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants