Skip to content

Commit

Permalink
fix: fix regexp error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Aug 20, 2022
1 parent fe38567 commit ebfc314
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Highlight: FC<PropsWithChildren<HighlightProps>> = (props) => {
const KeywordsInner: FC<PropsWithChildren<KeywordsProps>> = (props) => {
const { children, caseIgnored = true, color = 'inherit', backgroundColor = '#ffff00', value, render } = props;
if (typeof children !== 'string') return <Fragment>{children}</Fragment>;
const splitMatch = new RegExp(`${value}`, caseIgnored ? 'ig' : 'g');
const splitMatch = new RegExp((value || '').replace(/\\/g, '\\\\'), caseIgnored ? 'ig' : 'g');
const values = value ? children.match(splitMatch) : [];
const matched = children.split(splitMatch);
return (
Expand Down

0 comments on commit ebfc314

Please sign in to comment.