I'm trying to match the following file formats to prefix the files with an absolute URL. The strings are part of an index.html file and I'm using npm replace to find/replace. Here are the different file names:
- favicon.ico
- main.somestringwithcharacterandletters.css
- main.somestringwithcharacterandletters.js
- somestringwithcharactersandletters.woff
- somestringwithcharactersandletter.ttf
I've tried the following regex:
(main\.)?(\w)+\.(css|js|woff|woff2|eot|ttf|png|ico){1}
This matches the last character in the filename and the extension instead of the full filename and the extension. What needs to be changed to match the full filename so I can prefix an absolute path?

{1}is never ever useful in regex. A quantifier of 1 occurrence is the same as no quantifier(\w)+->(\w+). Instead of quantifying a group that captures the last matched value, you should quantify the pattern inside the group.$at the end to indicate that it should match the end part of the name no matter what intervening folders are called?