Use the regex, \\d+\\.\\d+\\.\\d+\\_(offline|online)
Demo:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
    public static void main(String[] args) {
        // Test strings
        String[] arr = { "EGA_SAMPLE_APP-iOS-master-9.1.1_offline-200710140849862",
                "EGA_SAMPLE_APP-iOS-master-9.2.3_online-200710140849862",
                "EGA_SAMPLE_APP-iOS-master-10.2.3_offline-200710140849862" };
        Pattern pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+\\_(offline|online)");
        // Print the matching string
        for (String s : arr) {
            Matcher matcher = pattern.matcher(s);
            while (matcher.find()) {
                System.out.println(matcher.group());
            }
        }
    }
}
Output:
9.1.1_offline
9.2.3_online
10.2.3_offline
Explanation of the regex:
- \\d+specifies one or more digits
- \\.specifies a- .
- \\_specifies a- _
- (offline|online)specifies- offlineor- online.
[Update]
Based on the edited question i.e. find anything between EGA_SAMPLE_APP-iOS-master- and -An_integer_number: Use the regex, EGA_SAMPLE_APP-iOS-master-(.*)-\\d+
Demo:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
    public static void main(String[] args) {
        // Test strings
        String[] arr = { "EGA_SAMPLE_APP-iOS-master-9.1.1_offline-200710140849862",
                "EGA_SAMPLE_APP-iOS-master-9.2.3_online-200710140849862",
                "EGA_SAMPLE_APP-iOS-master-10.2.3_offline-200710140849862",
                "EGA_SAMPLE_APP-iOS-master-anything here-200710140849862" };
        // Define regex pattern
        Pattern pattern = Pattern.compile("EGA_SAMPLE_APP-iOS-master-(.*)-\\d+");
        // Print the matching string
        for (String s : arr) {
            Matcher matcher = pattern.matcher(s);
            while (matcher.find()) {
                System.out.println(matcher.group(1));
            }
        }
    }
}
Output:
9.1.1_offline
9.2.3_online
10.2.3_offline
anything here
Explanation of the regex:
.* specifies anything and the parenthesis around it specifies a capturing group which I've captured with group(1) in the code.