You are here: PSPad forum > English discussion forum > add to Find help with NEAR two words in chosen distance with RegExp

add to Find help with NEAR two words in chosen distance with RegExp

#1 add to Find help with NEAR two words in chosen distance with RegExp

Posted by: trevor12 | Date: 2018-12-10 15:53 | IP: IP Logged

pls add to Find help with NEAR two words in chosen distance with RegExp

I tried

\bword1\W+(?:\w+\W+){1,6}?word2\b

or (for possibility in reverse order)

\b(?:word1\W+(?:\w+\W+){0,5}?word2|word2\W+(?:\w+\W+){0,5}?word1)\b

but without success

Options: Reply | Quote | Up ^


#2 Re: add to Find help with NEAR two words in chosen distance with RegExp

Posted by: vbr | Date: 2018-12-10 16:21 | IP: IP Logged

trevor12:
pls add to Find help with NEAR two words in chosen distance with RegExp

I tried

\bword1\W+(?:\w+\W+){1,6}?word2\b

or (for possibility in reverse order)

\b(?:word1\W+(?:\w+\W+){0,5}?word2|word2\W+(?:\w+\W+){0,5}?word1)\b

but without success

Hi,
it seems, PSPad doesn't support non-capturing groups via: (?:abc)
you can probably try normal grouping parens (abc). - I only briefly checked the first pattern, and it seems to match somehow, but I don't know the actual specification, cornercases etc.

hth,
vbr

Edited 1 time(s). Last edit at 2018-12-10 16:22 by vbr.

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR