feat: update hashtag regex
This commit is contained in:
@@ -2,7 +2,7 @@ import { EmbeddedHashtag } from '../components/Embedded'
|
||||
import { TEmbeddedRenderer } from './types'
|
||||
|
||||
export const embeddedHashtagRenderer: TEmbeddedRenderer = {
|
||||
regex: /#([^\s#]+)/g,
|
||||
regex: /#([\p{L}\p{N}\p{M}]+)/gu,
|
||||
render: (hashtag: string, index: number) => {
|
||||
return <EmbeddedHashtag key={`hashtag-${index}-${hashtag}`} hashtag={hashtag} />
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ export async function extractMentions(content: string, parentEvent?: Event) {
|
||||
|
||||
export function extractHashtags(content: string) {
|
||||
const hashtags: string[] = []
|
||||
const matches = content.match(/#([^\s#]+)/g)
|
||||
const matches = content.match(/#[\p{L}\p{N}\p{M}]+/gu)
|
||||
matches?.forEach((m) => {
|
||||
const hashtag = m.slice(1).toLowerCase()
|
||||
if (hashtag) {
|
||||
|
||||
Reference in New Issue
Block a user