-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
One of the Class Methods not working as expected #65
Comments
Hello @Beleggrodion, thanks for the Issue! :)
I reckon you're not using versions 0.9.0 and 0.9.1, but using the one from
It's not a misunderstanding at all, because I didn't document it on t-regx.com yet.
I know, that on t-regx.com webpage, it says that both undelimited and perl-compatible patterns are available (so But the I thought: "wait a second, what if someone uses Clearly t-regx guessing, which is which is a bad idea :D So I thought that it might be better, to introduce two methods: Pattern::of('^B', 'i')->test('b');
Pattern::of('^B', 'i')->test('B');
Pattern::pcre('/^B/i')->test('b');
Pattern::pcre('/^B/i')->test('B'); Try using Also, please don't hesitate to share your thoughts on the topic :) |
Also if (!Pattern::of("/^000413/i")->test($mac)) is the same as if (Pattern::of("/^000413/i")->fails($mac)) ;) |
Yes. I use dev-master in my composer.json file :) Because its a personal project and no problem if some stuff not working for some time until its fixed on the one or other way.
I assumed this, because i use the dev branch and no fixed version. ;-) So i decided to ask here.
If you see this in this way, is confusing because of so many possible options and variants.
Guessing in some functions is always not a good idea. In older php version this was a great problem i think. ;-)
I think it's a good idea, so people wo want to use the one one method can use the one, the other can use the other method.
i changed it in my code of the following test:
But i receive the following error message:
I thin the pattern should be ok, because i copied it from a python script, which use the same pattern:
I know that fails exist, but i like the way with the ! more ;-) Perhaps i'm to old school for this. |
For pattern Your earlier example, Try: private $_macPattern = "^(000413[0-9A-F]{6})|(00087[bB][0-9A-F]{6})$";
...
if (!Pattern::of($this->_macPattern)->test($mac)) and if (!Pattern::pcre("/^000413/i")->test($mac)) Hope I helped :) |
But you do bring an interesting point, a more proper exception should be raised for such usecase. Thanks for the precise exception report :) |
This is related to: #55 |
Thanks. It works now :) After i changed some parts to of and some to pcre. |
Nice, good to know! I'm closing this issue now, but please feel free to ask/contact me with anything! :D |
I don't know if it's a bug, or a Misunderstanding of the API. I used your Class in a project which i programmed for some tests last year in march.
I used the class like (this is one of the simpler usages)
if (!Pattern::of("/^000413/i")->matches($mac))
Now i see that this method is not existing anymore and was renamed to test, so i changed it to:
if (!Pattern::of("/^000413/i")->test($mac))
But now i always become "false" as return value, i only receive a true if i change the content of pattern 1:1 to the same value as the $mac value , so that it looks like a simple == value check.
One other usage is:
Which now also not working anymore.
The text was updated successfully, but these errors were encountered: