I write regex in Expect script and want use ([0-9]+)\r as regex pattern. To prevent of […] substitution I use curved braces:
expect -re {([0-9]+)\r} {...}
But \r in {…} have no special meaning in braces (treated as two chars). I try
expect -re {([0-9]+)}\r {...}
But this take parsing error. I try
expect -re [concat {([0-9]+)} "\r"] {...}
But concat add space between args.
PS. I know another solution with “…” quotes by quoting [:
expect -re "(\[0-9]+)\r" {...}
but would like hear solution with {…} quoting style…
You are correct: \r has no meaning inside { }, for that you need to use double quote, but need to escape the square brackets:
If you want to concatenate: