5

In Android Studio 2.2.2 in Find in Path I was trying search for the string

String params[]

so I typed it into the "Text to find:" box and I got the error

Bad pattern "String params[]" unclosed character class

What does this mean and how do I search for my string?

user316117
  • 7,971
  • 20
  • 83
  • 158
  • This is just a guess, but I think you have regular expressions on. See [this](https://i.stack.imgur.com/YBTE5.png). Uncheck that and see if it helps. – vmg Mar 22 '17 at 22:36
  • I checked here and yep, that replicates the problem. Turns out this is the actual answer. I'm posting an answer below. – vmg Mar 22 '17 at 22:41

5 Answers5

7

You have 'regular expressions' checked, so you're looking for that pattern.

See

this.

Uncheck that and see if it helps.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
vmg
  • 4,176
  • 2
  • 20
  • 33
1

First the Android Studio nice for search whole project, As mentioned those question 'Find All' in Android Studio and this Search all the occurrences of a string in the entire project in Android Studio

if you have the problem with 'Find in Path', you could test another like:
On Windows:
Find : Ctrl + F
Find And Replace In Single Class: Ctrl + R
on Mac:
Find : Command+ F
Find And Replace In Single Class: Command+ R

Community
  • 1
  • 1
Amir daraei
  • 63
  • 2
  • 12
1

Since this is the regular expression which you put in "text to find" . the [ and ] are itself used in regex so you have to escape these brackets or in other words tell the finder that it is part of string i want to search.. so

String params\[\] should work and you should get the usages of String params[].

Abdullah Raza
  • 600
  • 3
  • 9
0

In my case, once that 'find in path' stopped working. Then I found how to enable it again. You need to reformat the java code by rightclick on package node and the same with res node. There is an item within the list telling 'Reformat code'.

CodeToLife
  • 3,672
  • 2
  • 41
  • 29
-2

try...

String Params = params[90your int]