Skip to content

Commit

Permalink
fix(app): support non-ASCII characters for word boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Dec 13, 2023
1 parent 30a05b2 commit 1db478b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/current/utils/sourceMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ export const fetchData = async (language, issue) => {
export const checkAYFExplainingBeliefsAssignment = (source) => {
const { t } = getI18n();

const boundary = '(?:^|\\s|$)';
const talk = t('talk', { lng: Setting.source_lang, ns: 'source' });
const demonstration = t('demonstration', { lng: Setting.source_lang, ns: 'source' });
const searchKey = `\\b(${talk}|${demonstration})`;
const searchKey = boundary + `${talk}|${demonstration}` + boundary;
const regex = new RegExp(searchKey, 'i');
const result = source.match(regex);

Expand Down

0 comments on commit 1db478b

Please sign in to comment.