I'm trying to split this string :
Testing package [Store Management](https://www.Testing.com/content/zone_store_mgmt_policy\"Store Management Policy") Test package2
using regex, so it splits into 3 parts:
- Testing package
- [Store Management] (https://www.Testing.com/content/zone_store_spl_policy\"Store Management Policy")
- Test package2
The rule is split the string when the pattern [any characters](any characters)
is found.
This is what I tried :
String values ="Testing package [Store Management](https://www.Testing.com/content/zone_store_spl_policy\"Store Management Policy\") Test package2";
pattern = Pattern.compile("(?:\\[.*\\]\\(.*\\))");
valueArray = pattern.split(values);
for (String s: valueArray)
System.out.println(s);
But the output is:
Testing package Test package2
I need an array containing 3 strings as above.