Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #91202

Re: [OT] Help for a RegEx

From Paavo Helde <eesnimi@osa.pri.ee>
Newsgroups comp.lang.c++
Subject Re: [OT] Help for a RegEx
Date 2023-08-03 11:36 +0300
Organization A noiseless patient Spider
Message-ID <uafotr$luld$1@dont-email.me> (permalink)
References <uae4bc$6g1o$1@dont-email.me> <uae6gp$76ua$1@dont-email.me> <uaemss$achd$2@dont-email.me>

Show all headers | View raw


03.08.2023 01:55 MarioCPPP kirjutas:
> On 02/08/23 20:15, Paavo Helde wrote:
>>
>> For extracting the content of unknown pages 
> 
> they are not unknown : they are .odt exported as HTML, by LibreOffice.

Well, that makes things easier. If we can exclude some complications 
like CDATA, HTML comments and nested <p> tags, then it might be indeed 
possible to use regex to extract some content.

Be sure to use a non-greedy regex to match the closest end tag </p>, and 
the equivalent of /s or dotall for '.' to match newlines (or use 
(.|\r|\n) instead of dot). This seems to work at first glance:

grep -Po '<p (.|\r|\n)*?</p>' abc.xhtml

(-P is needed for grep to support non-greedy search).

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[OT] Help for a RegEx Fonntuggnio <JoeFonntuggnio@libbbero.it> - 2023-08-02 19:38 +0200
  Re: [OT] Help for a RegEx Christian Gollwitzer <auriocus@gmx.de> - 2023-08-02 20:00 +0200
    Re: [OT] Help for a RegEx MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-08-03 00:52 +0200
  Re: [OT] Help for a RegEx Paavo Helde <eesnimi@osa.pri.ee> - 2023-08-02 21:15 +0300
    Re: [OT] Help for a RegEx scott@slp53.sl.home (Scott Lurndal) - 2023-08-02 18:20 +0000
      Re: [OT] Help for a RegEx MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-08-03 00:56 +0200
    Re: [OT] Help for a RegEx MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-08-03 00:55 +0200
      Re: [OT] Help for a RegEx Paavo Helde <eesnimi@osa.pri.ee> - 2023-08-03 11:36 +0300
        Re: [OT] Help for a RegEx MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-08-04 02:01 +0200
          Re: [OT] Help for a RegEx Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-04 01:26 +0100
            Re: [OT] Help for a RegEx MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-08-05 02:17 +0200
              Re: [OT] Help for a RegEx jak <nospam@please.ty> - 2023-08-14 10:37 +0200
                Re: [OT] Help for a RegEx MarioCCCP <NoliMihiFrangereMentulam@libero.it> - 2023-08-15 14:14 +0200
                Re: [OT] Help for a RegEx jak <nospam@please.ty> - 2023-08-16 21:24 +0200
                Re: [OT] Help for a RegEx MarioCCCP <NoliMihiFrangereMentulam@libero.it> - 2023-08-18 21:05 +0200
                Re: [OT] Help for a RegEx jak <nospam@please.ty> - 2023-08-19 09:18 +0200
  Re: [OT] Help for a RegEx Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-02 11:58 -0700
  Re: [OT] Help for a RegEx wij <wyniijj5@gmail.com> - 2023-08-12 23:33 -0700

csiph-web