Rubymine Find in Path: Exclude a particular filename pattern? - rubymine

Using RubyMine's "Find in Path" search feature, I'd like to do a search on all files whole filenames do not match a particular pattern. For example, all files whose names do not include the string "test".
How can I do this?

This can be done by prefixing the file name match pattern in the "File mask" field with a ! (exclamation point) character.
For example, to have the search match all files that don't include the string "test", use the pattern: !*test*

Related

Add prefix to all class names in visual studio code

i aim to append prefix to each class name in my code. So i want class="text-black border-b p-2 border-gray-100 flex justify-between" to become class="tw-text-black tw-border-b tw-p-2 tw-border-gray-100 tw-flex tw-justify-between"
Try this find and replace:
Find: (?<=class="[^"]*)([^\s"]+)
Replace: tw-$1
See regex101 demo.
That uses a non-fixed length positive lookbehind (due to the * which can be any number) - so that regex will work in vscode's Find widget but not in the Search across files input. So only one file at a time.
Then the idea is to get all blocks that do not contain a space or " as a group $1.

officejs : Search Word document using regular expression

I want to search strings like "number 1" or "number 152" or "number 36985".
In all above strings "number " will be constant but digits will change and can have any length.
I tried Search option using wildcard but it doesn't seem to work.
basic regEx operators like + seem to not work.
I tried 'number*[1-9]*' and 'number*[1-9]+' but no luck.
This regular expression only selects upto one digit. e.g. If the string is 'number 12345' it only matches number 12345 (the part which is in bold).
Does anyone know how to do this?
Word doesn't use regular expressions in its search (Find) functionality. It has its own set of wildcard rules. These are very similar to RegEx, but not identical and not as powerful.
Using Word's wildcards, the search text below locates the examples given in the question. (Note that the semicolon separator in 1;100 may be soemthing else, depending on the list separator set in Windows (or on the Mac). My European locale uses a semicolon; the United States would use a comma, for example.
"number [0-9]{1;100}"
The 100 is an arbitrary number I chose for the maximum number of repeats of the search term just before it. Depending on how long you expect a number to be, this can be much smaller...
The logic of the search text is: number is a literal; the valid range of characters following the literal are 0 through 9; there may be one to one hundred of these characters - anything in that range is a match.
The only way RegEx can be used in Word is to extract a string and run the search on the string. But this dissociates the string from the document, meaning Word-specific content (formatting, fields, etc.) will be lost.
Try putting < and > on the ends of your search string to indicate the beginning and ending of the desired strings. This works for me: '<number [1-9]*>'. So does '<number [1-9]#>' which is probably what you want. Note that in Word wildcards the # is used where + is used in other RegEx systems.

How to use regex to include/exclude some input files in sc.textFile?

I have attempted to filter out dates for specific files using Apache spark inside the file to RDD function sc.textFile().
I have attempted to do the following:
sc.textFile("/user/Orders/201507(2[7-9]{1}|3[0-1]{1})*")
This should match the following:
/user/Orders/201507270010033.gz
/user/Orders/201507300060052.gz
Any idea how to achieve this?
Looking at the accepted answer, it seems to use some form of glob syntax. It also reveals that the API is an exposure of Hadoop's FileInputFormat.
Searching reveals that paths supplied to FileInputFormat's addInputPath or setInputPath "may represent a file, a directory, or, by using glob, a collection of files and directories". Perhaps, SparkContext also uses those APIs to set the path.
The syntax of the glob includes:
* (match 0 or more character)
? (match single character)
[ab] (character class)
[^ab] (negated character class)
[a-b] (character range)
{a,b} (alternation)
\c (escape character)
Following the example in the accepted answer, it is possible to write your path as:
sc.textFile("/user/Orders/2015072[7-9]*,/user/Orders/2015073[0-1]*")
It's not clear how alternation syntax can be used here, since comma is used to delimit a list of paths (as shown above). According to zero323's comment, no escaping is necessary:
sc.textFile("/user/Orders/201507{2[7-9],3[0-1]}*")

How do I search for two strings on the same line in Eclipse?

Mainly I want to search for all lines that contain XXX and YYY on the same line in Eclipse.
What would be the correct search expression for that?
This regex should comply with your request:
(XXX.*YYY|YYY.*XXX)
Used under File Search, checking Regular expression.
Use XXX*YYY in file search option.
This will mean that any characters can come in between XXX and YYY.

How to search in resource files in Eclipse? (escaped chars)

How do you search in resource files (*.properties) in Eclipse for string containing non-ASCII characters?
EDIT: Currently I use * in place of those special chars, but I'd prefer Eclipse to handle this for me: so it would either search for '\u00E1' in raw files when I enter 'á', or it might translate the files first and then just search for 'á'.
My apologize for not being specific enough when asking.
In Eclipse, you can use Search -> File Search . In the Search dialog, check the Regular expression option. Then enter this pattern in the Containing text: field to find non-ASCII characters:
[\u007f-\uffff]
(the square brackets are part of the pattern). Enter the File name patterns
*.properties
and then select which resources to search (selected resource, workspace, working set, etc.) and click OK
See also the Pattern javadoc for how to express such regular expressions.
Personally, I search them from the command line using grep, but you can search them in Eclipse by using a question mark in a non-regular-expression search, which should match any character. You can also use a period in a regular expression search.
The search dialog allows you to search for strings in *.resources files in the workspace.
Go to Search -> File. Enable the Regular Expressions checkbox - this also content assist to choose the regular expression according to your needs. In the file name patterns, give *.properties and then, Go :)