Click here to Skip to main content
15,886,518 members
Home / Discussions / C#
   

C#

 
GeneralRe: convert .mdf database file in text file Pin
Member 4876723-Nov-09 7:29
Member 4876723-Nov-09 7:29 
GeneralRe: convert .mdf database file in text file Pin
Md. Marufuzzaman3-Nov-09 7:49
professionalMd. Marufuzzaman3-Nov-09 7:49 
AnswerRe: convert .mdf database file in text file Pin
Gerry Schmitz3-Nov-09 19:01
mveGerry Schmitz3-Nov-09 19:01 
QuestionSaving on a Cell C# Pin
DinoRondelly3-Nov-09 5:35
DinoRondelly3-Nov-09 5:35 
AnswerRe: Saving on a Cell C# Pin
Richard MacCutchan3-Nov-09 5:46
mveRichard MacCutchan3-Nov-09 5:46 
QuestionHow to send a BREAK signal to RS232 Pin
cansaco3-Nov-09 5:31
cansaco3-Nov-09 5:31 
AnswerRe: How to send a BREAK signal to RS232 Pin
OriginalGriff3-Nov-09 5:35
mveOriginalGriff3-Nov-09 5:35 
QuestionRegEx to match formula groups [modified] Pin
Björn T.J.M. Spruit3-Nov-09 4:15
Björn T.J.M. Spruit3-Nov-09 4:15 
Forgive me if my question is unclear, I'll do my best to clarify it as best as I can.
What I'm trying to do is "Tokenize" nested formula's by using RegEx.

Consider the following formula in LaTeX:
LaTeX Example 1: text before \frac{ \frac{ SubPart 1 }{ SubPart 2 } }{ Part 2 } text after
What I need is a RegEx that can tokenize this LaTeX formula to output the following tokenlist:
Token[0] = text before
Token[1] = \frac{ \frac{ SubPart 1 }{ SubPart 2 } }{ Part 2 }
Token[2] = text after

Looking at Token[1], it has a nested fracture (\frac{...}) in its top-part.
That's the way I need it to be to build an object tree.
In a sense, the fracture in the top-part is a child to it's parent fracture.


Consider the following formula in LaTeX:
LaTeX Example 2: text before \frac{ \left ( SubPart 1 + SubPart 2 \ right ) }{ Part 2 } text after
This should result in the following tokenlist:
Token[0] = text before
Token[1] = \frac{ \left ( SubPart 1 + SubPart 2 \ right ) }{ Part 2 }
Token[2] = text after

Again, looking at Token[1], it has a nested subformula in it.
In this case, the subformula is a child, associated to the toppart of the fracture, to the fracture object.


Final example (and then I assume you catch my drift):
 text before \left ( \frac{ SubPart 1 }{ SubPart 2 } \ right ) + X text after
This should result in the following tokenlist:
Token[0] = text before
Token[1] = \left ( \frac{ SubPart 1 }{ SubPart 2 } \ right )
Token[2] = + X text after


The nested-/sub-formulas will be processed when the parent formula is being constructed, so we need not worry about that part of it here.
What I need, is a RegEx that can handle formula dimensions to the nth degree.

Right now I do this by stepping through the string and seeing if I have a match in the sub-string for a particular item.
When found, I add 1 to a level counter and run an internal loop to find the final closing "}" that brings the level back to 0;
This works fine, but I've been commented upon by using this method and not using tokens, begotten with the use of RegEx.

If anyone has a suggestion of how I should construct my regex, then please let me know.
I've gotten as far as:
Fracture : (\\frac{[\W].*?((}\s)|(}$)))*
Subformula : (\\left \([\W].*?\\right \))*
But as you would guess, this fails miserably when having to deal with nested or multidimensional formulas.
Any help and/or insight on the matter would be greatly appreciated.

modified on Tuesday, November 3, 2009 10:28 AM

AnswerRe: RegEx to match formula groups Pin
PIEBALDconsult3-Nov-09 4:42
mvePIEBALDconsult3-Nov-09 4:42 
GeneralRe: RegEx to match formula groups Pin
Björn T.J.M. Spruit3-Nov-09 4:59
Björn T.J.M. Spruit3-Nov-09 4:59 
GeneralRe: RegEx to match formula groups [modified] Pin
PIEBALDconsult3-Nov-09 5:44
mvePIEBALDconsult3-Nov-09 5:44 
GeneralRe: RegEx to match formula groups [modified] Pin
Björn T.J.M. Spruit4-Nov-09 5:09
Björn T.J.M. Spruit4-Nov-09 5:09 
AnswerRe: RegEx to match formula groups Pin
OriginalGriff3-Nov-09 5:33
mveOriginalGriff3-Nov-09 5:33 
GeneralRe: RegEx to match formula groups Pin
Björn T.J.M. Spruit4-Nov-09 23:02
Björn T.J.M. Spruit4-Nov-09 23:02 
Questioncreating a report Pin
JollyMansArt3-Nov-09 4:07
JollyMansArt3-Nov-09 4:07 
QuestionC# default interface method? Pin
Mark McArthey3-Nov-09 4:05
Mark McArthey3-Nov-09 4:05 
AnswerRe: C# default interface method? Pin
Ghydo3-Nov-09 5:07
Ghydo3-Nov-09 5:07 
GeneralRe: C# default interface method? Pin
Mark McArthey3-Nov-09 6:43
Mark McArthey3-Nov-09 6:43 
GeneralRe: C# default interface method? Pin
Ghydo3-Nov-09 7:36
Ghydo3-Nov-09 7:36 
AnswerRe: C# default interface method? Pin
PIEBALDconsult3-Nov-09 7:40
mvePIEBALDconsult3-Nov-09 7:40 
AnswerRe: C# default interface method? Pin
Gerry Schmitz3-Nov-09 19:09
mveGerry Schmitz3-Nov-09 19:09 
QuestionIssue Launching UI Application from windows service in c# Windows Pin
platso_5883-Nov-09 3:46
platso_5883-Nov-09 3:46 
AnswerRe: Issue Launching UI Application from windows service in c# Windows Pin
Covean3-Nov-09 4:07
Covean3-Nov-09 4:07 
GeneralRe: Issue Launching UI Application from windows service in c# Windows Pin
platso_5883-Nov-09 20:16
platso_5883-Nov-09 20:16 
GeneralRe: Issue Launching UI Application from windows service in c# Windows Pin
Covean3-Nov-09 22:03
Covean3-Nov-09 22:03 

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.