I have a groovy script that you can find in this link.
String str = '# hosts.inventory [vpc] vpc ec2 [ec2] vpc ec2 [project:children] vpc ec2 [author] [publisher] [dispatcher] '
str.split((/^\[author\]$/))
for( String values : str )
println(values);
I would like to split my string into two parts:
- Everything before
[author]
ie# hosts.inventory [vpc] vpc ec2 [ec2] vpc ec2 [project:children] vpc ec2
- Everything after
[author]
ie[publisher] [dispatcher]
My regex doesn't seem to work. How do I solve this problem?