Title |
Test
Find
Pattern Title
|
Expression |
((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]* # key part (surrounding whitespace stripped)
\=
(\s)*(?<Value>([^\n^\s]+(\n){0,1}))) # value part (surrounding whitespace stripped) |
Description |
Regular expression to fetch <key-value> pairs from the old-fashioned .ini files. Key and Value appears in form of named captures with whitespaces stripped on both ends. |
Matches |
webProxyPort=8080 | webProxyPort = 8080 | webProxyPort = 8080 |
Non-Matches |
abcdefghijk |
Author |
Rating:
Not yet rated.
Alexander Pinsker
|
Source |
http://alexpinsker.blogspot.com/2005/12/regular-expression-to-parse-ini-files.html |
Your Rating |
|
Title: How to deal comment
Name: exatex
Date: 8/2/2011 11:26:48 AM
Comment:
Suppose:
Key1 = Value1 ; My comment
Key = Key1
Value = Value1
Comment = Comment
Other issue:
Key1 = "Value1;value2)
Key = Key1
Value = "Value1;Value2"
Comment =