mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2009
Posts: 17
A
AD1C Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Nov 2009
Posts: 17
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?


Jim Reisert
http://www.ad1c.us/
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
noop $regex($1-,/ (\d+)/)
if ($regml(1) isnum 28000-29700) {

Joined: Nov 2009
Posts: 17
A
AD1C Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Nov 2009
Posts: 17
Will this also work?

noop $regex(%spotline,/ (\d+)/)
if ($regml(1) isnum 28000-29700) {


Jim Reisert
http://www.ad1c.us/
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
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.

Joined: Nov 2009
Posts: 17
A
AD1C Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Nov 2009
Posts: 17
It's all working fine, thanks.


Jim Reisert
http://www.ad1c.us/

Link Copied to Clipboard