I don’t think the problem is that “([^\s]]+)” is capturing everything. Rather you are matching/capturing nothing. So you are just getting back the original string. My guess is that the the single line flag does not work with replace.
Try replacing "/^.?\[fpath:([^\s\]]+)]?.+$/s"
with "/^.*?\[fpath:([^\s\]]+)]([^a]|[a])*/"
.
This will accomplish basically the same thing without requiring the single line flag.
Jim - The Monday Man (YouTube Channel)
Watch Our Latest Video: The monday ITEM ID column - What most people don’t know.
Contact me directly here: Contact – The Monday Man