fix re
This commit is contained in:
@@ -157,8 +157,8 @@ export class HighlightedMarkdown extends Component {
|
|||||||
['url_pid', URL_PID_RE],
|
['url_pid', URL_PID_RE],
|
||||||
['url', URL_RE],
|
['url', URL_RE],
|
||||||
['pid', PID_RE],
|
['pid', PID_RE],
|
||||||
['nickname', NICKNAME_RE],
|
|
||||||
['tag', TAG_RE],
|
['tag', TAG_RE],
|
||||||
|
['nickname', NICKNAME_RE],
|
||||||
];
|
];
|
||||||
if (props.search_param) {
|
if (props.search_param) {
|
||||||
let search_kws = props.search_param.split(' ').filter((s) => !!s);
|
let search_kws = props.search_param.split(' ').filter((s) => !!s);
|
||||||
@@ -180,8 +180,15 @@ export class HighlightedMarkdown extends Component {
|
|||||||
return (
|
return (
|
||||||
<span key={idx}>
|
<span key={idx}>
|
||||||
{rule === 'url_pid' ? (
|
{rule === 'url_pid' ? (
|
||||||
<span className="url-pid-link" title={p}>
|
<span
|
||||||
/##
|
className="url-pid-link"
|
||||||
|
title={p}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
props.show_pid(p.split('##')[1]);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{p}
|
||||||
</span>
|
</span>
|
||||||
) : rule === 'url' ? (
|
) : rule === 'url' ? (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
export const PID_RE = /(^|[^\d\u20e3\ufe0e\ufe0f])(#\d{1,7})(?![\d\u20e3\ufe0e\ufe0f])/g;
|
export const PID_RE = /(^|[^\d\u20e3\ufe0e\ufe0f])(#\d{1,7})(?![\d\u20e3\ufe0e\ufe0f])/g;
|
||||||
// TODO: fix this re
|
// TODO: fix this re
|
||||||
// export const URL_PID_RE=/((?:https?:\/\/)?thuhole\.com\/?#(?:#|%23)([2-9]\d{4,5}|1\d{4,6}))(?!\d|\u20e3|\ufe0e|\ufe0f)/g;
|
// export const URL_PID_RE=/((?:https?:\/\/)?thuhole\.com\/?#(?:#|%23)([2-9]\d{4,5}|1\d{4,6}))(?!\d|\u20e3|\ufe0e|\ufe0f)/g;
|
||||||
export const URL_PID_RE = /((?:https?:\/\/)?hole\.thu\.monster\/?#(?:#|%23)(\d{1,7}))(?!\d|\u20e3|\ufe0e|\ufe0f)/g;
|
export const URL_PID_RE = /(https:\/\/thuhollow\.github\.io\/?#(?:#|%23)(?:\d{1,7}))(?!\d|\u20e3|\ufe0e|\ufe0f)/g;
|
||||||
export const NICKNAME_RE = /(^|[^A-Za-z])((?:(?:Angry|Baby|Crazy|Diligent|Excited|Fat|Greedy|Hungry|Interesting|Jolly|Kind|Little|Magic|Naïve|Old|PKU|Quiet|Rich|Superman|Tough|Undefined|Valuable|Wifeless|Xiangbuchulai|Young|Zombie)\s)?(?:Alice|Bob|Carol|Dave|Eve|Francis|Grace|Hans|Isabella|Jason|Kate|Louis|Margaret|Nathan|Olivia|Paul|Queen|Richard|Susan|Thomas|Uma|Vivian|Winnie|Xander|Yasmine|Zach)|You Win(?: \d+)?|洞主)(?![A-Za-z])/gi;
|
export const NICKNAME_RE = /(^|[^A-Za-z])((?:(?:(?:Alice|Bob|Carol|Dave|Eve|Francis|Grace|Hans|Isabella|Jason|Kate|Louis|Margaret|Nathan|Olivia|Paul|Queen|Richard|Susan|Thomas|Uma|Vivian|Winnie|Xander|Yasmine|Zach) )*(?:Alice|Bob|Carol|Dave|Eve|Francis|Grace|Hans|Isabella|Jason|Kate|Louis|Margaret|Nathan|Olivia|Paul|Queen|Richard|Susan|Thomas|Uma|Vivian|Winnie|Xander|Yasmine|Zach))|洞主)(?![A-Za-z])/gi;
|
||||||
export const URL_RE = /(^|[^.@a-zA-Z0-9_])((?:https?:\/\/)(?:(?:[\w-]+\.)+[a-zA-Z]{2,7}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,5})(?::\d{1,5})?(?:\/[\w~!@#$%^&*()\-_=+[\]{};:,./?|]*)?)(?![a-zA-Z0-9])/gi;
|
export const URL_RE = /(^|[^.@a-zA-Z0-9_])(https?:\/\/(?:(?:[\w-]+\.)+[a-zA-Z]{2,9}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,5})(?::\d{1,5})?(?:\/[\w~!@#$%^&*()\-_=+[\]{};:,./?|]*)?)(?![a-zA-Z0-9])/gi;
|
||||||
|
|
||||||
export const TAG_RE = /(^|\s)(#[^#\s]{1,32})($|\s|#)/g;
|
export const TAG_RE = /(^|\s)(#[^#\s]{1,32})($|\s|#)/g;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user