0
set %some1 (2)
set %some2 (3)

Now can i get the value of some1 which is in the brackets and change it to something else using $regsubex
So anyone can help?

Sasuke Kun
  • 2,449
  • 3
  • 15
  • 14

1 Answers1

0

You can use $regex() to get the numeric value inside the parenthesis:

; find the value
noop $regex(%some1, (\d+))

; print the value
echo -a Value: $regml(1)

Will print:

2

Likewise, you can use the same regex but with $regsub() this time to change that value:

; replace the value inside the () and put it back in %some
noop $regsub(%some1, (\d+), 98765, %some1)

; print that value
echo -a %some1

Will print:

(98765)
Wiz
  • 2,145
  • 18
  • 15