Re: [Pyparsing] To parse any language character set
Brought to you by:
ptmcg
From: Ujjaval S. <usm...@gm...> - 2008-10-28 02:44:36
|
Hi Eike, Thats exactly what I wanted. Thanks for that. It worked for me. One more question following what I've done which is really stupid.... I wanted to end each text with a new line character. For example: text6 = 'ABC | iöü | 应iöü | XYZ\r' Now to parse such sentence, I changed your parser code to the following: Here, I want to parse this string as a string that starts with 'ABC' followed by '|' and ends with '\r'. I need everything in between with '|' as delimiter in a list including 'XYZ' as last element in this case. start_kw = Keyword('ABC') fieldContents = Optional(CharsNotIn('|'),'') fields = delimitedList(fieldContents, '|', False) fieldSep = Literal('|').suppress() the_parser = (start_kw + fieldSep + fields + Literal('\r').suppress()) I can't get it to work. Could you tell what I am doing wrong? Thanks, On Tue, Oct 28, 2008 at 2:30 AM, Eike Welk <eik...@gm...> wrote: > On Monday 27 October 2008, Eike Welk wrote: > > > > Here is an example for CharsNotIn: > > http://pastebin.com/f7d6a3331 > > I just see that pastebin can't correctly work with Asian characters. > But I guess you understand how the example was meant anyways. Just > paste some Asian characters into the example strings and replace > these numbers (HTML entities?) with them. The original characters > were taken from Chinese and Japanese I-Pod ads. > > Kind regards, > Eike. > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Pyparsing-users mailing list > Pyp...@li... > https://lists.sourceforge.net/lists/listinfo/pyparsing-users > |