Eclipse search multiple strings in any order, case insensitive - regex

I think the title is pretty self-explanatory. I have a big project in Eclipse Juno CDT and I want to search the whole workspace for matches to the strings 'max' 'hfr' & 'fps'. For a successful match they must all be on the same row, in any order, case or count. They can be part of words (variable names), so it is not exactly a word search.
Is this a job for regex, and what regex exactly? Or is there a hidden search feature in Eclipse that can let me do that easily?

If I understood well what you want to do. You simply need to use the eclipse search tool with regular expression (CTRL + H or Search>Search in eclipse menu). You'll see there's a lot of option and possibilities to configure your research, including using regular expression. You just need to construct the right regexp.
I hope this will help.

Related

How to find non localised strings in a swift project

How can I find all strings a project that are not being localised?
My goal is to add support for localisation by generating the XLIFF file, via Editor->Export For Localisation. In order to do that, I first added comment for Localiser where needed in the Storyboard.
Next, I need to find in the code all Strings that do not use NSLocalizedString("...", comment:"...").
Is there a way to find all these strings?
I didn't succeed writing a regex to find them, due to my lack of competence in regex.
My goal is to have a regex like this:
[withIdentifier: |NSLocalizedString(]".*"
in order to find all strings surrounded by quotes, and that are not precedeed by some keywords.
I tried with no success using negative look ahead with
A regular expression to exclude a word/string
It's not meant for automated replacement, but just to have a quick view if I haven't forgotten some strings.
Thank you very much!
OBJC
There is a possible way that you can find ALL The Strings which are not used by NSLocalizedString
Goto Product -> Analyze
From Left Panel you can see
Where you can find each and every string which are not Localized
On tap on that
XCode will tell you issue
SWIFT3
I am not Sure about solution NOT TESTED
https://medium.com/#pinmadhon/finding-non-nslocalized-strings-in-xcode-8-in-swift-3-or-objc-589ee279a166

Eclipse file search regex to include search phrase and exclude particular strings

This is for all you regex hounds.
I need to filter my search in eclipse when I do a file search.
I am looking for aTracker but this brings back hundreds of results so I want to be able to thin the results out.
First off I would like to remove aTracker.sendException and possibly others.
This is a common problem for me so I'm finally posting for a solution so I don't need to go fetch my waders every time a search like this comes along.
To match all aTracker except aTracker.sendException, you can use a negative lookahead if eclipse supports it:
aTracker(?!\.sendException)
You should check the 'Regular expression' box I think.

Visual Studio 2010: pattern based search replace other than regex?

I've taken over a project that is full of code like this:
if (aTraceUserids[t].Trim().ToUpper() == Userid().Trim().ToUpper())
{
// ...
}
What is - using tool-assisted expression formulation - a good way to do a search replace into something like this on a case by case base:
if (aTraceUserids[t].Equals(Userid(), StringComparison.InvariantCultureIgnoreCase))
{
// ...
}
Edit (thanks Dave for making me think on this further):
I know this should be possible with regular expressions, but those are hard to get right and document, so I wonder about tool assisted ways that help me both phrase the expressions and execute them.
Ideally I'm looking for a pattern based search/replace tool that allows me to
enter the search/replace patterns
enter the patterns for the files and directory names to match
visually assists me with the search/replace matches, and allows me to post-edit each occurrence
I don't care much which platform as these kinds of search/replace actions will likely apply to other big code bases as well.
So: any solution based on *nix, Windows or web are fine. CygWin and/or WINE based solutions are fine too. (That's why I removed the VS2010 tag and added some platform tags).
Since this was originally tagged with 'Visual Studio', Visual Studio itself can do regular-expression based find/replace, and the standard 'Find and Replace' dialog will let you pick and choose by hitting 'Find Next', 'Replace' or 'Replace All' as you choose.
For example, I recently changed an API from;
Log.Error(string message, bool someotherArg);
to
Log.Error(string message);
And easily used Visual Studio to replace all usage throughout my codebase of this modified API like so;
Find what;
Log.Error({.*}, true);
Replace with:
Log.Error(\1);
The backquote in the replace line \1 puts the grouped regex contained by {...} into that spot in the replace.
Handy, and built-in. Works for me.

search in visual studio using regexp

I have a situation where i need to search for couple of objects in my code files. currently i m doing it by seaching using visual studio search option for every text i want to search.
I want to use regular expression ( search -> use -> regular expression ) to search all my text at once using OR operator.
Please suggest me for that, as i am not much familiar with regular expression syntax.
Sry for editing in question itself..
I got the answer. Like if I want to search for objects 'abc','xyz' I would put abc|xyz in visual studio seach box. But i don't know how to make this search case insensitive. I got a hint of using /i or -i or ?i , but where and how - i don't know .
As far as I know, Visual Studio should search case insensitive, unless you check the box that says "Match case" (see screenshot).
You can use the alternation operator | to effectively OR part of the regex. So (foo)|(bar) will find either the text "foo" or the text "bar". Either side, can of course, be a regular expression on its own, so you can come up with some pretty complicated stuff.
But as zzzzBov said, if you want any more help you're going to have to supply more information. Or you could actually, you know, read the documentation.
I've found that the search in file using regular expression is buggy in regard to case sensitivity in Visual Studio 2015. Even with the "Match case" option turned on, it will match text ignoring case by default.
The one trick that somehow fixed this is by using capture, surrounding the literal text you want with parenthesis in addition to the "Match case" option!
So instead of: abc.def
Use: (abc).(def)

Removing everything between a tag (including the tag itself) using Regex / Eclipse

I'm fairly new to figuring out how Regex works, but this one is just frustrating.
I have a massive XML document with a lot of <description>blahblahblah</description> tags. I want to basically remove any and all instances of <description></description>.
I'm using Eclipse and have tried a few examples of Regex I've found online, but nothing works.
<description>(.*?)</description>
Shouldn't that work?
EDIT:
Here is the actual code.
<description><![CDATA[<center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"><th>ID</th><td>308</td></tr></table></center>]]></description>
I'm not familiar with Eclipse, but I would expect its regex search facility to use Java's built-in regex flavor. You probably just need to check a box labeled "DOTALL" or "single-line" or something similar, or you can add the corresponding inline modifier to the regex:
(?s)<description>(.*?)</description>
That will allow the . to match newlines, which it doesn't by default.
EDIT: This is assuming there are newlines within the <description> element, which is the only reason I can think of why your regex wouldn't work. I'm also assuming you really are doing a regex search; is that automatic in Eclipse, or do you have to choose between regex and literal searching?