I would like to replace every symbol of a word after -
with *
.
For example:
asd-wqe ffvrf => asd-*** ffvrf
In TS regex it could be done with (?<=-\w*)\w
and replacement *
. But default python regex engine requires lookbehinds of fixed width.
Best I can imaging is to use
(?:(?<=-)|(?<=-\w)|(?<=-\w{2}))\w
and repeat lookbehing some predetermined big number of times, but it seems not very sustainable or elegant.
Is it possible to use default re
module for such a task with some more elegant pattern?
Demo for testing here.
P.S. I'm aware that alternative regex engines, that support lookbehind of variable length exist, but would like to stick with default one for a moment if possible.