Math operations in regex

using Perl:

s/.*doc=(\d+).*/"www.site.com\/headline\/".($1+100000).".article"/e;

as you’ve done with e flag, the right part becomes now an expression. so you have to wrap the non-capture part as strings.

Leave a Comment