-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Description
hi i need way to ignore groups in regex for example in modern browser which support Positive lookbehind
i can simply do this in regex find pattern with word boundary :
pattern = XRegExp("(?<=[\s\p{P}\p{S}]|^)("+words+")(?=[\s\p{P}\p{S}]|$)", "g");
findAndReplaceDOMText($($jQueryObject2).find('.pagebody').get( 0 ), {
find: pattern,
replace: function(portion, match) {
var el = document.createElement('mark');
el.classList.add("mark");
el.innerHTML = portion.text;
return el;
}
});
the issue with this start group boundary :
(?<=[\s\p{P}\p{S}]|^)
its not supported with old browser so i use alternative like this:
pattern = XRegExp("(^|[\s\p{P}\p{S}])("+term+")(?=[\s\p{P}\p{S}]|$)", "g");
but that will also capture first group which i don't want so how can i ignore first group in this pattern:
(^|[\s\p{P}\p{S}])("+term+")(?=[\s\p{P}\p{S}]|$)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels