Click here to Skip to main content
15,899,124 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CMap template error Pin
IGx894-Oct-02 7:54
IGx894-Oct-02 7:54 
GeneralRe: CMap template error Pin
Christian Graus4-Oct-02 11:09
protectorChristian Graus4-Oct-02 11:09 
GeneralRe: CMap template error Pin
Chris Losinger3-Oct-02 17:58
professionalChris Losinger3-Oct-02 17:58 
GeneralRe: CMap template error Pin
IGx894-Oct-02 7:52
IGx894-Oct-02 7:52 
GeneralRe: CMap template error Pin
Tomasz Sowinski4-Oct-02 0:11
Tomasz Sowinski4-Oct-02 0:11 
Questionapi available for this purpose? Pin
imran_rafique3-Oct-02 15:36
imran_rafique3-Oct-02 15:36 
Generalregular expression problems Pin
Roman Nurik3-Oct-02 13:33
Roman Nurik3-Oct-02 13:33 
GeneralRe: regular expression problems Pin
Jörgen Sigvardsson3-Oct-02 14:17
Jörgen Sigvardsson3-Oct-02 14:17 
If you want to match a string with an arbitrary number of letters and commas, you will not succeed I'm afraid.

What you want is a context-free grammar for your input "language". I'm not sure if you are familiar with BNF (Backis-Naur Form), but here's such a grammar notation:
<string> ::= <string> <letter_comma_group>
         | (empty)
<letter_comma_group> ::= ['a'-'z'] ','


Regular expressions can only handle languages which follow something called regular grammars. Regular grammars cannot handle self reference - thus you will not be able to do what you want.

Please see Chomskys grammar hierarchy[^] for more information on this topic.

If you want to solve your problem, I suggest you look into writing a recursive descent parser http://www.wikipedia.org/wiki/Recursive_descent_parser[^]. But before you start implementing the grammar I mentioned above, please make sure you rewrite it to be LL(n) compatible. (Left-recursion in an LL(n) grammar is a big no-no! Try it and you'll find out why. Smile | :)

<string> ::= <letter_comma_group> <opt_string>
         |   (empty)
<opt_string> ::= <letter_comma_group> <opt_string>
             | (empty)
<letter_comma_group> ::= ['a'-'z'] ','


Good luck!

--
Please state the nature of your medical emergency.
GeneralRe: regular expression problems Pin
Jon Hulatt3-Oct-02 21:52
Jon Hulatt3-Oct-02 21:52 
General*.bmp *.wbmp conversion Pin
3-Oct-02 12:27
suss3-Oct-02 12:27 
GeneralRe: *.bmp *.wbmp conversion Pin
Jörgen Sigvardsson3-Oct-02 13:35
Jörgen Sigvardsson3-Oct-02 13:35 
GeneralRe: *.bmp *.wbmp conversion Pin
Anonymous3-Oct-02 13:59
Anonymous3-Oct-02 13:59 
GeneralRe: *.bmp *.wbmp conversion Pin
Chris Losinger3-Oct-02 18:00
professionalChris Losinger3-Oct-02 18:00 
QuestionThis 'works' but would you ever want to ?? Pin
RedZenBird3-Oct-02 12:21
RedZenBird3-Oct-02 12:21 
AnswerRe: This 'works' but would you ever want to ?? Pin
RedZenBird3-Oct-02 12:49
RedZenBird3-Oct-02 12:49 
AnswerRe: This 'works' but would you ever want to ?? Pin
Jörgen Sigvardsson3-Oct-02 13:47
Jörgen Sigvardsson3-Oct-02 13:47 
GeneralRe: This 'works' but would you ever want to ?? Pin
RedZenBird3-Oct-02 14:46
RedZenBird3-Oct-02 14:46 
GeneralRe: This 'works' but would you ever want to ?? Pin
Jörgen Sigvardsson3-Oct-02 15:06
Jörgen Sigvardsson3-Oct-02 15:06 
GeneralRe: This 'works' but would you ever want to ?? Pin
RedZenBird3-Oct-02 15:16
RedZenBird3-Oct-02 15:16 
GeneralCAsyncSoccket Pin
moloko3-Oct-02 11:59
moloko3-Oct-02 11:59 
GeneralRe: CAsyncSoccket Pin
Alexthombra3-Oct-02 19:21
Alexthombra3-Oct-02 19:21 
GeneralRe: CAsyncSoccket Pin
moloko4-Oct-02 14:25
moloko4-Oct-02 14:25 
GeneralUndocumented Windows APIs Pin
uniken3-Oct-02 11:59
uniken3-Oct-02 11:59 
GeneralRe: Undocumented Windows APIs Pin
Andreas Saurwein4-Oct-02 0:33
Andreas Saurwein4-Oct-02 0:33 
GeneralCListCtrl OnColumnClick Pin
ns3-Oct-02 10:44
ns3-Oct-02 10:44 

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.