Also I would like to wild card 46, something like ABCCoreUI-*
Workaround: useI think no one answered what you asked "FIX your pattern to match any digit at the end of your string, maybe due to behavior of +* (1 or more) instead ofcharacter at last position, output is concatenating 47+42"
You may wrap the regexp in *'' to prevent (0Shell Globs
Then, to match zero or more) in regexp: digits
sed -r 's/ABCCoreUI-[\d]+[0-9]*/ABCCoreUI-47/' file.json
[\d]is to match one digit[\d]+is to match one to more digits+, unlike*, has no meaning in shell globs, thus you can use it as last caracter insedregexp
As [Richard][1] said in his comment, the best sould be to prevent [shell globs][2] on the last * by prefixing it with .:
sed -r 's/ABCCoreUI-.*[[:digit:]]*/ABCCoreUI-47/' file.json
ABCCoreUI-.*to match "ABCCoreUI-" then 0 or more caracters
And I finally got the regexp toTo match zero or more digits at the end of the regexpzero or more characters
sed -r 's/ABCCoreUI-[[:digit:]]*.*/ABCCoreUI-47/' file.json
-ris to enable extendedsedregexp[0-9]or[[:digit:]]to match a digit (POSIX) to match a digit[0-9]*or[[:digit:]]*to match zero or more digits.*to match zero or more characters
(still searching a solution to use * if you really need zero or more caracters, as a last caracter of a Note that sed\d regexp)
[1]: sed find and replace in file
[2]: https://yakking.branchable.com/posts/regexps/is not working.