Click here to Skip to main content
15,570,087 members
Home / Discussions / Regular Expressions
   

Regular Expressions

 
Question[Solved] Pin
Marco Bertschi20-Mar-14 5:10
professionalMarco Bertschi20-Mar-14 5:10 
Me again. RegEx again.

Problem: I need to parse a string which consists out of Key-Value pairs.
Keys are separated from values by a "=". Values can contain a "=", but they must be escaped as "\=".
Example
Key1=Text And escaped\= More stuff\=is here Key2=Value number2

Of course the second key can contain an escaped \=, too. Long story short: Values can be a normal string (any character), except that the equal sign must be escaped.

So far I got (?<=\s|^)([\w ]+)=(\w \\=*)?(?=[ \w=]|[$]) , but it only keeps ordinary Key=value pairs, cutting of at whitespaces.

Edit: Thanks to Richard, who provided a perfectly suitable solution.
I will never again mention that Dalek Dave was the poster of the One Millionth Lounge Post, nor that it was complete drivel.


modified 20-Mar-14 13:03pm.

GeneralRe: A little help needed... Pin
Marco Bertschi20-Mar-14 6:24
professionalMarco Bertschi20-Mar-14 6:24 
GeneralRe: A little help needed... Pin
Haloniels19977-Sep-14 12:36
Haloniels19977-Sep-14 12:36 
QuestionRe: A little help needed... Pin
Kornfeld Eliyahu Peter20-Mar-14 5:55
professionalKornfeld Eliyahu Peter20-Mar-14 5:55 
AnswerRe: A little help needed... Pin
Marco Bertschi20-Mar-14 6:21
professionalMarco Bertschi20-Mar-14 6:21 
GeneralRe: A little help needed... Pin
Kornfeld Eliyahu Peter20-Mar-14 6:37
professionalKornfeld Eliyahu Peter20-Mar-14 6:37 
GeneralRe: A little help needed... Pin
Marco Bertschi20-Mar-14 6:49
professionalMarco Bertschi20-Mar-14 6:49 
GeneralRe: A little help needed... Pin
Kornfeld Eliyahu Peter20-Mar-14 7:27
professionalKornfeld Eliyahu Peter20-Mar-14 7:27 
GeneralRe: A little help needed... Pin
Marco Bertschi20-Mar-14 11:17
professionalMarco Bertschi20-Mar-14 11:17 
GeneralRe: A little help needed... Pin
Kornfeld Eliyahu Peter20-Mar-14 11:58
professionalKornfeld Eliyahu Peter20-Mar-14 11:58 
GeneralRe: A little help needed... Pin
Marco Bertschi20-Mar-14 12:21
professionalMarco Bertschi20-Mar-14 12:21 
GeneralRe: A little help needed... Pin
Kornfeld Eliyahu Peter20-Mar-14 12:28
professionalKornfeld Eliyahu Peter20-Mar-14 12:28 
GeneralRe: A little help needed... Pin
Marco Bertschi20-Mar-14 12:59
professionalMarco Bertschi20-Mar-14 12:59 
GeneralRe: A little help needed... Pin
Kornfeld Eliyahu Peter20-Mar-14 13:08
professionalKornfeld Eliyahu Peter20-Mar-14 13:08 
GeneralRe: A little help needed... Pin
Marco Bertschi20-Mar-14 13:14
professionalMarco Bertschi20-Mar-14 13:14 
JokeRe: A little help needed... Pin
Kornfeld Eliyahu Peter20-Mar-14 13:17
professionalKornfeld Eliyahu Peter20-Mar-14 13:17 
GeneralRe: A little help needed... Pin
Marco Bertschi20-Mar-14 21:23
professionalMarco Bertschi20-Mar-14 21:23 
GeneralRe: A little help needed... Pin
Kornfeld Eliyahu Peter20-Mar-14 23:42
professionalKornfeld Eliyahu Peter20-Mar-14 23:42 
AnswerRe: A little help needed... Pin
Marco Bertschi20-Mar-14 23:52
professionalMarco Bertschi20-Mar-14 23:52 
AnswerRe: A little help needed... Pin
Richard Deeming20-Mar-14 7:00
mveRichard Deeming20-Mar-14 7:00 
GeneralRe: A little help needed... Pin
Marco Bertschi20-Mar-14 8:02
professionalMarco Bertschi20-Mar-14 8:02 
AnswerRe: [Solved] Pin
Kenneth Haugland20-Mar-14 21:55
mvaKenneth Haugland20-Mar-14 21:55 
GeneralRe: [Solved] Pin
PIEBALDconsult25-Mar-14 13:30
professionalPIEBALDconsult25-Mar-14 13:30 
QuestionMATLAB Code Pin
Member 1068110218-Mar-14 20:02
Member 1068110218-Mar-14 20:02 
QuestionRe: MATLAB Code Pin
Richard Deeming19-Mar-14 3:04
mveRichard Deeming19-Mar-14 3:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.