mirror of
https://github.com/sorenpeter/timeline.git
synced 2025-12-15 19:07:01 +00:00
Hashtags now support special characters like accents
This commit is contained in:
parent
ce17f2042b
commit
ee7e6558b2
1 changed files with 5 additions and 3 deletions
|
|
@ -124,7 +124,8 @@ function getImagesFromTwt(string $twtString) {
|
|||
|
||||
function getTagsFromTwt(string $twtString) {
|
||||
//$pattern = '/(?<!\()\B#\w+(?!\))/iu';
|
||||
$pattern = '/(?<=\B)#(\w+)/';
|
||||
//$pattern = '/(?<=\B)#(\w+)/';
|
||||
$pattern = '/(?<=\B)#([\p{L}\p{N}_]+)/u';
|
||||
//$pattern = '/(?<=\s)#(\w+)/';
|
||||
//$pattern = '/\s#(\w+)/';
|
||||
//$pattern = "/\(#\w{7}\)/";
|
||||
|
|
@ -213,7 +214,8 @@ function replaceImagesFromTwt(string $twtString) {
|
|||
|
||||
function replaceTagsFromTwt(string $twtString) {
|
||||
//$pattern = '/#(\w+)?/';
|
||||
$pattern = '/(?<=\s)#(\w+)/';
|
||||
//$pattern = '/(?<=\s)#(\w+)/';
|
||||
$pattern = '/(?<=\B)#([\p{L}\p{N}_]+)/u';
|
||||
|
||||
//$replacement = '<a href="#">#\1</a>'; // Dummy link
|
||||
$replacement = '<a href="?search=$1" class="tag">#${1}</a>';
|
||||
|
|
|
|||
Loading…
Reference in a new issue