Is it recommendable to use anchors inside capturing groups? I am trying to simulate lookbehind operation with that pattern to match line start or whitespace.
For example to match hashtags which are in beginning of the line or after whitespace AND they will end the line or there is whitespace after them, is there better way to do it than this?
(^|\s)#([\w]+)($|\s)
I left non capturing groups for the sake of simplicity.