java - How to match a string between two same delimiters? -


some-string-test-moretext.csv

i want extract string test, found after 2nd , 3rd - delimiter.

the expression [-](.*?)[-] match -string-. it's close, how can move on next match?

if matters, i'm using java.

if know number of delimiters in advance, can split string.

string[] test = {      "some-string-test-moretext.csv",      "another-string-test-andthensome.csv" }; (string s: test) {     system.out.println(s.split("-")[2]); } 

output

test test 

Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -