Page 1 of 1

[Solved]How to use substr in macros.txt?

Posted: 25 May 2019, 09:02
by blodycandy
hello,
I need get third number from a lot of number

There are 10 random numbers,Every time is different

^5613265165

^2153261952

I found information about perl Function substr can help me get number

but how to use substr in macros.txt?

I tried like this:

automacro pp {
exclusive 1
run-once 1
map geffen
console /: \^(.*)/
call {
log $.lastMatch1
$aa = $.lastMatch1
$bb = @eval(substr($aa),3,1)
release all
stop
}
}

but not work,please help me,thanks before

Re: How to use substr in macros.txt?

Posted: 26 May 2019, 03:55
by c4c1n6kr3m1
understand this pattern
http://jkorpela.fi/perl/regexp.html

console /\d\d(\d)\d\d\d\d\d\d\d/

Re: How to use substr in macros.txt?

Posted: 26 May 2019, 12:40
by gamenikko
Just plain

Code: Select all

/\d/
would be enough.