linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabrizio Sestito <lain@neotes.org>
To: linux-c-programming@vger.kernel.org
Subject: Re: Pattern matching programming
Date: Wed, 18 May 2005 20:09:29 +0000	[thread overview]
Message-ID: <200505182009.29868.lain@neotes.org> (raw)
In-Reply-To: <33128.200.91.100.219.1116437772.squirrel@www.crearium.com>

On Wednesday 18 May 2005 17:36, fabio@crearium.com wrote:
> Hello,
>
> I am trying to code a small C program that basically takes a long text
> file with data that comes from a mysql server.
>
> But I realize It is better to use regular expression. This is an examples
> of the text:
>
> =1 <p> blah </p> <div foo>{$foobar}</div>blah.... <p>linux rulez</p>
> misc characters.... =2 blah blah <p> linux rulez again</p>....
> <p>foo</p?blah
>
>
> And so on.
>
> The patterns are:
>
> The record is represented by an equal. Ej, record 1 is "=1", record 2 is
> "=2" and so on.
>
> The desired text is where "linux rulez" is inside, it is the FIRST <p>
> </p> AFTER a record.
>
> So, I see that program this makes no sense because it is better to use sed
> and awk.
>
> The result I want to have is something like:
>
> 1 linux rulez
> 2 linux rulez again
> 3 linux rulez so far
> ...etc
>
> The idea is elimate all <div>'s tags, then get the numbers (maybe with awk
> -F"="), and then get the next <p> taq, remove the tags themself and
> numbers and then the text and do the same procedure for all the 65230
> records.
>
> Thanks alot for any comment, sorry for the 'offtopic'
>
> Kind regards,
>
> fabio
>
Why don't you use an XML parser library?

Fabrizio

  reply	other threads:[~2005-05-18 20:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-18 17:36 Pattern matching programming fabio
2005-05-18 20:09 ` Fabrizio Sestito [this message]
2005-05-20  1:55   ` Hareesh Nagarajan
2005-05-20 20:36 ` Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200505182009.29868.lain@neotes.org \
    --to=lain@neotes.org \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).