How can I make inverse regexp work

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
carouselcarousel
Junior Member
Junior Member
Posts: 6
Joined: 2022-04-21, 14:04 UTC

How can I make inverse regexp work

Post by *carouselcarousel »

hello,

I was trying to look for every folder which NOT contain "2021".
So I thought it's an easy regexp:
ALT+F7, mark RegEx, and used

Code: Select all

^((?!2021).)*$
for some reason I get an error message "lookaround brackets must be at the very beginning/ending (pos3) .
(Adding a "\" to the pos3 didn't help)

What am I missing? I tried it in different online regexp tools and there it works.
When I use the multi rename tool everything is cool and I use this inverse regularly: .

Code: Select all

*(\w\w\[[^\[]+\[[^\[]+\]).*
Thank you in advance.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: How can I make inverse regexp work

Post by *Dalai »

It's easier without regex via the Plugins tab of TC's search:

Code: Select all

tc | path | !contains | 2021
Instead of "path" you might need to use "fullname".

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
white
Power Member
Power Member
Posts: 4595
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: How can I make inverse regexp work

Post by *white »

carouselcarousel wrote: 2022-11-22, 22:46 UTC ..for some reason I get an error message "lookaround brackets must be at the very beginning/ending (pos3)
Your expression is not supported due to a limitation of the used regular expression library:
Docs>>Regular expressions (RegEx)#Assertions wrote: Limitations:
  • Brackets for lookahead must be at the very ending of expression, and brackets for lookbehind must be at the very beginning. So assertions between choices |, or inside groups, are not supported.
carouselcarousel
Junior Member
Junior Member
Posts: 6
Joined: 2022-04-21, 14:04 UTC

Re: How can I make inverse regexp work

Post by *carouselcarousel »

Thank you for the replies both of you!
I also tried to work with the CTRL+F12 thing maybe that is capable to do it.

The plugin search is a good idea!! Didn't thought abotu that! Thank you for that too!
User avatar
white
Power Member
Power Member
Posts: 4595
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: How can I make inverse regexp work

Post by *white »

Because it may be helpful to people, I will post a reply to this old thread with another solution.
carouselcarousel wrote: 2022-11-22, 22:46 UTC I was trying to look for every folder which NOT contain "2021".
So I thought it's an easy regexp:
ALT+F7, mark RegEx, and used

Code: Select all

^((?!2021).)*$
for some reason I get an error message "lookaround brackets must be at the very beginning/ending (pos3) .
It can be done using this regular expression:

Code: Select all

^(?!.*2021)
Post Reply