I'm trying to use PHP's preg_replace to replace every #CODE-123 kind of token to /CODE-123.
It works pretty well except for one last detail, I'd need to remove the # from the string the second time I use it but I cannot figure out how.
Here's what I have so far:
echo preg_replace('/#.*-[0-9]*/i', '[${0}](/${0})', $this->description);
It works and replaces #CODE-123 to [#CODE-123](/#CODE-123) but I'd need it to be [#CODE-123](CODE-123) instead.
Any idea? Thanks!
.*by something else more explicit, this will reduce the regex engine work and avoid possible errors.