regex - Java - Pattern matching between the same pattern -


my sample string:

 ghgduysgd fdferfdf bvfxbgdf gdfgdfg 

i need find contents between a's.

i have (?<=a).* matches contents after a. want find between a.

first iteration: ghgduysgd

second iteration: fdferfdf

i want data above manipulation. can regex?

you alrady use lookbehind in regex, change use lookahead:

(?<=a).*(?=a|$) 

then make .* non-greedy stop @ first available "ending" a:

(?<=a).*?(?=a|$) 

edit: a|$ tobias_k's comment below, a


Comments

Popular posts from this blog

PHP while loop dynamic rowspan -

timer - Java TimerTask cancel -

android - How to read a column value in parse.com without accessing an object or a pointer -