fix: word boundaries, no regex lookbehind support for Safari (#1114)
This commit is contained in:
@@ -2,7 +2,7 @@ export default (input: string): RegExp => {
|
||||
const words = input.split(' ');
|
||||
|
||||
// Regex word boundaries that work for cyrillic characters - https://stackoverflow.com/a/47062016/1717697
|
||||
const wordBoundaryBefore = '(?:(?<=[^\\p{L}\\p{N}])|^)';
|
||||
const wordBoundaryBefore = '(?:(?:[^\\p{L}\\p{N}])|^)'; // Converted to a non-matching group instead of positive lookbehind for Safari
|
||||
const wordBoundaryAfter = '(?=[^\\p{L}\\p{N}]|$)';
|
||||
|
||||
const regex = words.reduce((pattern, word, i) => {
|
||||
|
||||
Reference in New Issue
Block a user