Exclude folder except one subfolder via regular expression in Eclipse - regex

I want to add a Resource Filter in Eclipse to exclude a folder named target including all it's files and subfolders except exactly one of this subfolders (target/scala-2.11/classes_managed).
Here is the regex I used for this (including examples for subdirectories):
https://regex101.com/r/aQ2qM1/1
In the referenced example it seems the regex works fine.
However when I apply this regex in Eclipse it does not work.
What's the correct way to write the regex so it works in Eclipse?
Thank you!

You don't need to get all fancy with regular expressions, you can tell eclipse to "Include only" the Folders with a Name matching:
target/scala-2.11/classes_managed
That will exclude all the files that you wish.

Related

Include regexes in Sublime Text SFTP plugin

I only see "ignore_regexes" option in the Sublime SFTP config.json. Is there any way to include only certain files, for example, .h, .c and .cpp files alone from all the subfolders under the mapped folder?
Looking at the documentation for the package, the only setting that looks like it would do something like this is the ignore_regexes option that you've already found.
As such, I think the only way to do what you want would be to use a regular expression that matches everything but the files that you're interested in so that it ignores all files except the ones that you want to view.
An example of such a regular expression (which I only midly tested but seems to work) is the following (adapted from this question):
^(.(?!\.(c|h|cpp)))*$
In use, as mentioned in the documentation examples you should use \\ instead of \ in the config file since it's JSON and \ has special meaning in JSON data.

cmake source_group has no effect

I'm trying to organize a project generated for visual studio 2015 using the source_group function to add specific folders to the project, but it have no effect, here is how i do it:
set(CPP_FILES_REGEX "\\b(\\w|\\d)+\\b\\.(hpp|cpp|c|h)")
source_group("my_folder" REGULAR_EXPRESSION "${sourcers_dir}\/${CPP_FILES_REGEX}")
add_executable(my_executable ${sourcers_dir}/main.cpp ${sourcers_dir}/test.hpp)
Testes the regex here: RegExr and it works fine so the executables are being match. I also tried to add the file name but it still have no effect:
set(CPP_FILES_REGEX "\\b(\\w|\\d)+\\b\\.(hpp|cpp|c|h)")
source_group("my_folder" FILES "${sourcers_dir}/main.cpp")
CMake's regexes are fairly basic in what they understand, see the docs. "Fancy" named classes and pseudo-classes like \b, \w or \d are not supported. You'll have to spell them out manually (i.e. use [0-9] instead of \d etc.)

hgignore regex expression for excluding all files except 1 folder

I'm trying to ignore all .SQL files, except if they are under the DatabaseSchema folder.
This is the regex expression I came up with:
^(?!DatabaseSchema\\).*\.sql$
This seems to work on all the regex testing sites (for example http://regexr.com/ and https://regex101.com/) but when I run it through mercurial it doesn't ignore either of these test files:
DatabaseSchema\test.sql
testRoot.sql
I'm using syntax: glob at the start of my hgignore before switching to regex at the end for this 1 case by using "syntax: regex".
Is there something I'm missing about the way mercurial uses regex in the hgignore file?

Filter for .h and .cpp files (kdevelop)

on kdevelop, you can configure a file filter ( on top of project tree ). Normally, the project tree shows a lot of files with different extensions, e.g xy.conf, xy.prf, moc_xy.cpp, moc_xy.h and so on. I want hide all unnessary files with following regex: [^\moc][a-z]*\.(h|cpp). But if I use this regex, it shows me no files. Whats wrong with this regex?
I also, read this post but the answer: \.(h|c(pp)?)$ doesn't work.
Best regards, Chris
You can only show *.h/c/cpp files in your project by first excluding all files * and then adding these inclusive patterns for them.
Like this, e.g. add this to your .gitignore/.hgignore file:
*
!*.h
!*.c
!*.cpp
If you don't have such filter files, you can configure them in the kdevelop's project fileter by adding includes and excludes:
try this:
.(h|c(pp)?)$
it works when i tested it here

How to hgignore all files of a particular extension except in one directory and its subdirectories?

I would like to use the .hgignore file of Mercurial to ignore all files with file extension .tex, except those .tex files in one particular directory and whatever subdirectory of this directory.
I presume syntax: regexp will be required for this.
A brief explanation of the particular regular expression used, would also be very welcome, so that we can all learn a bit here.
Let's say you want to exclude the directory named exclude. The following regex would then match all files that end in .tex unless exclude/ comes somewhere before that:
^(?!.*\bexclude/).*\.tex$