Fuzzy search method

Hi, I’m developing a plugin of idea2025.2.

There is a function to filter list of name by a search text inputted by user.
in java, it can be described as public static boolean match(String text, String query)

But just use String.contains is not a very smart method, and I find the style of fuzzy search in idea is useful and smooth,

for example, match(“com.apache.tool.test”,“apatool.test”), match(“com.apache.tool.test”,“catt”) is true

I don’t know how to describe the search rule by natural language exactly, and I implement the method by myself but the complexity is high.

so is there ready-made method in idea2025.2 that I can use directly in developing plugin or is the algorithm open source?

Thanks

I have found by asking ChatGPT
NameUtil.buildMatcher("*ctd").build().matches("csfsf-tsdfsf-ddd")

1 Like