altralaser
altralaser

Reputation: 2073

File search with regex doesn't work in eclipse

I've a problem to use the file search in eclipse (Mars). Let's say I've some source files in which I set button captions:

public void init() {
  okayButton.setText("OK");
  cancelButton.setText("Cancel");
  browseButton.setText("Browse...");
}

Now I want to find out the files with these definitions. So I pressed Ctrl+H and changed to the "File search" tab. There I activated the "Regular expression" checkbox and typed in this search string:

Button\.setText\("[a-z0-9\.]+"\)

But the result is that nothing is found. What I've done wrong?

Upvotes: 0

Views: 93

Answers (1)

Federico Piazza
Federico Piazza

Reputation: 31045

Nothing is wrong in eclipse, your regular expression simply doesn't match any of the string you want to search. All your strings detailed in your question starts with uppercase and you are searching for strings that start with lowercase.

You have to change your search string to:

Button\.setText\("[A-Za-z0-9\.]+"\)

Regex demo

Upvotes: 1

Related Questions