I'm going mad atm, trying to figure it out?
fade2k |
|
||
---|---|---|---|
I'm my oddball quest to learn PHP, I've been working on simple applications (what better way to learn right?). So I find myself using preg_replace to convert usernames into links in posts using preg_replace. My hangup so far has been the whole regex .. I get it .. sort-of.
The shoutlink is just a link to the members profile. Anyway, it works if the !username is on the first line of the input but when there are new lines without a space afterwords and another !username -- both fail to be replaced with the link. What gives? Does preg_replace see new lines as part of the input (\n!username) or does it ignore it? LoL thanks ahead of time. - Be Kind, Please Rewind -
|
GHengeveld |
|
||
---|---|---|---|
I think what you're looking for is something like this:
A helpful tool to check your regular expressions is here: http://gskinner.com/RegExr/ By the way, don't you think the @ sign is more appropriate (considering Twitter's usage of this). |
fade2k |
|
---|---|
Thank you & Thanks for the link! Your probably right about the @ sign -- Got use to a pesky !bot =0D I'm slowly getting ahang of this stuff =0) - Be Kind, Please Rewind -
|