Class SearchUtils


  • public final class SearchUtils
    extends Object
    Utils to use global search
    • Method Detail

      • getGroups

        public static String[] getGroups​(String text,
                                         String searchText)
        Returns all string matching occurrences in the given text by the searchText regexp.
        Parameters:
        text - the text to search in, cannot be null
        searchText - the regexp expression or simple text to search, cannot be null
        Returns:
        an array with all found string occurrences, never null
      • getGroupsWithOffsets

        public static Collection<Pair<String,​Integer>> getGroupsWithOffsets​(String text,
                                                                                  String searchText,
                                                                                  boolean caseSencetive)
        Returns all string matching occurrences in the given text by the searchText regexp with their offsets.
        Parameters:
        text - the text to search in, cannot be null
        searchText - the regexp expression or simple text to search, cannot be null
        Returns:
        a collection with pairs: found string occurrences and its offset, never null
      • searchTextRegions

        public static Collection<org.eclipse.jface.text.IRegion> searchTextRegions​(String pattern,
                                                                                   String text)
        Search specific text pattern and return collection of region of matches in given text.

        Note this search is case insensitive.

        Parameters:
        pattern - the text pattern to search, cannot be null
        text - the text to search in, cannot be null
        Returns:
        collection of regions with matches, never null