Java regex positive lookahead -


i've been having problems generating regex particular string.

my source string set of key-value pairs. desired output here sample string:

:27b:hello: world!           world: hello :29a:test :30:something isn't right-} 

desired output:

key: 27b  value: hello: world!           world: hello key: 29a  value: test key: 30   value: isn't right 

and here regex far:

(\\d+\\w?):([\\w\\d\\s'/,:\\q.()\\e]+(?=(:\\s*\\d+\\w?:|\\-\\}))) 

the problem seem capturing entire message.

   e.g. key: 27b value:hello: world!                   world: hello     :29a:test     :30:something isn't right 

what should regex extract these key/value pairs?

+ greedy, [\\w\\d\\s'/,:\\q.()\\e]+ capture characters last point in string @ lookahead can match. grab first such point need use "reluctant" version +? instead.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -