$hfind can't find regex that matches $null
#263076
24/05/18 09:27 PM
|
Joined: May 2018
Posts: 13
Seb
OP
Pikka bird
|
OP
Pikka bird
Joined: May 2018
Posts: 13 |
alias testcase {
var %regex = /^$/
echo -a -- $regex(%regex,$null) ; verify regex matches
hadd -m testcase %regex 42
echo -a -- $hfind(testcase,$null,0,R) ; <--- bug here; $hfind returns non-numeric value when it should return 1
}
|
|
|
Re: $hfind can't find regex that matches $null
[Re: Seb]
#263081
24/05/18 10:36 PM
|
Joined: Jan 2004
Posts: 1,473
maroon
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 1,473 |
I'm guessing that $null is being treated as if a missing a required parameter, and is the same as $hfind(testcase,,0,R)
|
|
|
Re: $hfind can't find regex that matches $null
[Re: maroon]
#263083
25/05/18 02:28 AM
|
Joined: Feb 2003
Posts: 2,722
Raccoon
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,722 |
> $regex(%regex,$null)
Incorrect $regex() syntax. Try $regex($null,%regex)
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
Re: $hfind can't find regex that matches $null
[Re: Seb]
#263085
25/05/18 09:24 AM
|
Joined: Jul 2006
Posts: 3,738
Wims
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 3,738 |
Confirmed on 7.52 non beta
Raccoon: the first $regex test is meant to show the attempt of $hfind(,,,R)'s function
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
|
|
|
Re: $hfind can't find regex that matches $null
[Re: Wims]
#263090
25/05/18 08:45 PM
|
Joined: Feb 2003
Posts: 2,722
Raccoon
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,722 |
It remains that the first $regex test is incorrect, and it incorrectly represents $hfind -R
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
Re: $hfind can't find regex that matches $null
[Re: Raccoon]
#263091
25/05/18 09:49 PM
|
Joined: Jul 2006
Posts: 3,738
Wims
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 3,738 |
How is it incorrect? It's unusual but it's to illustrate the report, it does ask if the regular expression "" matches the string "/^$/", which is what $hfind's R is doing
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
|
|
|
Re: $hfind can't find regex that matches $null
[Re: Wims]
#263092
25/05/18 10:03 PM
|
Joined: Feb 2003
Posts: 2,722
Raccoon
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,722 |
$hfind -R (reversed regex) is where regular expression patterns are stored in a hash table, and compared against the normal string passed in the $hfind parameter. $null is the normal string, not an 'unusual pattern'.
Just look at it. It's wrong, and you're wrong. :P
This isn't to say that $hfind() supports $null string parameters -- it doesn't -- but at least grasp the fundamentals of how mIRC works, Ouims!
$hfind() never works in any situation when $null is passed, whether -n -w -W -r -R are specified. This is a limitation of $hfind()
(The $regex qualitative test is still wrong.)
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
Re: $hfind can't find regex that matches $null
[Re: Raccoon]
#263093
25/05/18 10:15 PM
|
Joined: Jul 2006
Posts: 3,738
Wims
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 3,738 |
Uh well you're right that pattern don't become test string, I mixed things up here, but the usage of $regex is still valid/correct, (even if it's pointless), and the issue on $hfind does exist.
I disagree it's a limitation, $hfind should not be limited on the input it can receive, if $hfind were limited with the $null usage here, it wouldn't return incorrect value, it would return 0 instead of a possible positive integer
Last edited by Wims; 25/05/18 10:18 PM.
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
|
|
|
Re: $hfind can't find regex that matches $null
[Re: Wims]
#263094
25/05/18 10:22 PM
|
Joined: Feb 2003
Posts: 2,722
Raccoon
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,722 |
$hfind() gives no return value when '$null' is passed. This indicates that it does not work, as it does not work with many identifiers.
We would have a problem if $hfind() returned 0 or some other value that isn't nothing. Nothing means Error.
Should, or can, it be made to work? Sure, why not. I could see it useful in cases of $hfind(table,$null,0).data to discover table entries with null empty values. Or, whatever the original poster is trying to do as well.
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
Re: $hfind can't find regex that matches $null
[Re: Raccoon]
#263095
25/05/18 10:39 PM
|
Joined: Jul 2006
Posts: 3,738
Wims
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 3,738 |
This parameter is a string parameter, I can't think of any identifier which takes a string parameter which won't work with $null. This is not an error, $hfind should return 1 here.
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
|
|
|
Re: $hfind can't find regex that matches $null
[Re: Wims]
#263124
03/06/18 06:40 PM
|
Joined: May 2018
Posts: 13
Seb
OP
Pikka bird
|
OP
Pikka bird
Joined: May 2018
Posts: 13 |
Yes, my bad, I meant to reverse the $regex parameters... Corrected testcase: alias testcase {
var %regex = /^$/
echo -a -- $regex($null,%regex) ; verify regex matches
hadd -m testcase %regex 42
echo -a -- $hfind(testcase,$null,0,R) ; <--- bug here; $hfind returns non-numeric value when it should return 1
}
|
|
|
Re: $hfind can't find regex that matches $null
[Re: Seb]
#263985
18/10/18 10:00 AM
|
Joined: Dec 2002
Posts: 4,863
Khaled
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 4,863 |
Thanks this issue has been fixed for the next version.
|
|
|
|
|