Regex / Wild Card Search for two words within a span

16 views
Skip to first unread message

Ulrike

unread,
Jul 23, 2025, 3:53:09 AMJul 23
to AntConc-Discussion

Hello,

I'm trying to search a way to find occurrences of two words within a distances, in AntConc, where I the first and last word are given, but not the words in between, and where the number of these words in between may vary. For example, I’d like to find sequences like:

un [0 to 6 words] intéressant

…which should match things like:

  • un intéressant

  • un exemple intéressant

  • un petit exemple intéressant

  • un très bon cas intéressant, etc.

ChatGPT gave me regular expressions such as:

\bun\b.*?\bintéressant\b

and

\bun\b\s+(\w+\s+){0,5}intéressant\b

But these either return nothing, or produce unexpected results (e.g., matching lune or intéressante). 

Is there any supported way in AntConc to search for two fixed words with a variable number of words in between? Or some kind of workaround?

Thank you for any help with this!

Ulrike

Laurence Anthony

unread,
Jul 23, 2025, 8:36:41 PMJul 23
to ant...@googlegroups.com
Hi Urike,
There are two ways to achieve this goal. The first is to use the "Zero or more characters" wildcard (*). So, you would have 
un******intéressant

The second is to use the advanced search function and set one of the words as being in a 6-word context window of the other word.

I hope that helps!

Laurence


--
You received this message because you are subscribed to the Google Groups "AntConc-Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antconc+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/antconc/3f89dccf-5486-4301-88c9-71461bb5f9a5n%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages