[英]Replace matching text with href links
I have a string like:我有一个像这样的字符串:
@test hello how are you @abcdef
How would I automatically make it so it converts all text that has @ to something like:我将如何自动制作它以便将所有具有 @ 的文本转换为类似以下内容:
https://example.com/test
https://example.com/abcdef
I've tried using regex and preg_replace but can't get it down perfectly.我试过使用 regex 和 preg_replace 但无法完美地完成它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.