Wednesday, June 7, 2017

Re: Is there a simple way to |^a| and |^x| ?

On 06.06.17 09:26, Tim Chase wrote:
> Ah, I'd misunderstood that it was ignoring the sign and you wanted
> to respect it. But you *wanted* to ignore the sign. Thus, you can
> omit the optional sign:
>
> :'<,'>s/\d\+/\=submatch(0)+22/g
>
> or move the "\zs" after the optional minus-sign
> to get the desired result:
>
> :'<,'>s/property=-\=\zs\d\+/\=submatch(0)+22/g
>
> In both cases, submatch(0) becomes just the number without the sign.
>
> Beware the first one may do odd things in the event you have decimal
> numbers in your file, so it would change "11.1" to "33.23" since you
> don't anchor the left side.

Fortunately the dimensions are all integer mm in this case, so that
would be OK. But the problem with Postscript (or generated CNC gcode for
that matter) is that the tendency to an excess of magic numbers risks
that some of them could be unrelated to the desired redimensioning. The
correct solution is to introduce more variables, then the whole problem
goes away. It just all takes time, and a quick dash for the finish line
was tempting.

Erik

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment