Reputation: 11
the strings are like
/fruit]
/animal/lion
/plant/flower/rose
and i want to get only first word without slash and blacket which means fruit, animal, plant.
I did until [^\/]*[a-z] *
but i have no idea what is next step. can somebody help me?
Thanks
Upvotes: 1
Views: 583
Reputation: 9916
In Splunk, this should do it.
... | rex field=foo "(?<word>\w+)" | ...
Upvotes: 1
Reputation: 363
String before = "...";
String after = before.replaceAll("[/](\w+).*", "$1");
And you can use "after".
(Java solution)
Upvotes: 0