I previously asked this question entirely wrong so making another attempt. Don't hang me!
Text is retrieved from a file.
Blah blah blah blah<br />blah blah blah<br />#text to be a color<br />blah blah
I have code that preg_replace the word connected to the symbol but I can not get the regex to go from the symbol to the end of the line aka from <br />
# to before <br />
Here is my code for the symbol word
$line = preg_replace('/(?<!\w)#([0-9a-zA-Z]+)/m', '<span class='alt'>#$1</span>', $line);
After searching, basically what I want to regex is like the greentext thing on 4chan but I can not find code examples of replacing the entire line IF ONLY a new line begins with the symbol.
)?#([^<]*)/m'` – Nigel Ren Mar 17 '20 at 20:50
)#([^<]*)`, which is the start or the `
` – Nigel Ren Mar 17 '20 at 21:10