mIRC Home    About    Download    Register    News    Help

Print Thread
#270990 06/11/22 11:06 PM
Joined: Jan 2004
Posts: 1,944
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
When N is greater than 1, it doesn't ever find a match when using the ^ anchor:

//bset -t &v 1 abcdef | echo -ag 1 vs 0 vs 0: $bfind(&v,2,bc,foo).regex vs $bfind(&v,2,^bc,foo).regex vs $bfind(&v,2,^.*f,foo).regex

Joined: Dec 2002
Posts: 5,225
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,225
In the case of the last $bfind() in your example, PCRE is interpreting this as: for string "abcdef", search for ^.*f (matching from the beginning of the string), but only return results from position 2 onwards. In this call, the ^*.f will match from position 1 onwards, so PCRE says no match was found.

Joined: Jul 2006
Posts: 3,960
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,960
This implementation of $bfind().regex is the report.

I'm the one, among others, who requested regex for binvar and this is not how I wanted it to be implemented

What was expected is that with $bfind(&b,2,/pattern/).regex, the input that mIRC would to pass to pcre is $bvar(&b,2-).

Otherwise, with the current implementation, a bcopy is required to set up a new binvar before calling $bfind(), very, very not handy because

1) I have a large binvar, creating a second one can easily fail
2) I do not want to destroy my current binvar nor i want to save it temporarily (could fail, but I just don't.)
3) I don't want to copy anything

Can you make the implementation make the input string start at the Nth position in the binvar instead of scripter having to do it? There are no good reason a scripter would want the current implementation, because of the way regex works, /g etc.

Thanks


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2006
Posts: 3,960
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,960
Thanks for changing $bfind


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard