Regular Expressions 101

Community Patterns

extract java property name and value

1

Regular Expression
PCRE (PHP <7.3)

/
(?<propName>[A-Za-z0-9_.-]+)(?<assign>\s*(?:=|:)\s*)(?<propVal>(?:[^\r\n\\]++|\\(?:\r?\n|\r|.))*+$)
/
mg

Description

correctly handle the case where the value is splitted on multiple lines.

Submitted by Zart Colwing - 9 years ago