mIRC Homepage
Posted By: AD1C Locate number within string of words - 02/10/11 06:54 PM
I am working on a script that parses the data in strings like this:

(W6RK-Bot) spot: W6JTI Humboldt, CA (fixed) 28043.3 CW

I want to locate the number in the string, i.e. 28043, and check to see if it's within a numerical range (ie. 28000-29700). I looked at isin() and iswc() but neither seems to be sufficient for my needs. The string above is an example, there can be more/fewer words both before and after the number. How can I do this?
Posted By: Tomao Re: Locate number within string of words - 02/10/11 07:19 PM
Code:
noop $regex($1-,/ (\d+)/)
if ($regml(1) isnum 28000-29700) {
Posted By: AD1C Re: Locate number within string of words - 02/10/11 09:01 PM
Will this also work?

noop $regex(%spotline,/ (\d+)/)
if ($regml(1) isnum 28000-29700) {
Posted By: Tomao Re: Locate number within string of words - 02/10/11 09:32 PM
Yes, it'll work if the variable %spotline contains the string you want to match. The regex will catch the number before the decimal point and then compare it to see if it's within the range 28000 to 29700, as shown. I don't know what your actual script looks like. The example I've come up with above is merely based on your description.
Posted By: AD1C Re: Locate number within string of words - 03/10/11 09:32 PM
It's all working fine, thanks.
© mIRC Discussion Forums