Tuesday, 15 September 2015

java - Regular expression -



java - Regular expression -

i reading properties file in java:

@name=single line value @description=multiline value ... user@server.com @key=single line value

i want match every key/value pair. keys prefixed '@' character, , multiline values allowed. using regex (global, multiline): ^@[^@]+=.+\n*[^@]*. please, see http://regexr.com/39p9b details , testing.

the problem leaving out values '@' in middle, e-mail addresses. how can prepare regex? thanks.

you utilize next one:

class="lang-none prettyprint-override">^@[^=]+=(?:[^@]|(?<!^)@)+$

debuggex demo

don't forget multiline flag.

java regex

No comments:

Post a Comment