Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #91195
| From | Christian Gollwitzer <auriocus@gmx.de> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: [OT] Help for a RegEx |
| Date | 2023-08-02 20:00 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <uae5jb$6vko$1@dont-email.me> (permalink) |
| References | <uae4bc$6g1o$1@dont-email.me> |
Am 02.08.23 um 19:38 schrieb Fonntuggnio: > > Sorry for the total OT, but I failed to build a RegEx with the "help" > (rotfl) of three different so called IA, getting to nothing > > I am scanning an HTML document (not in javascript, so I do not have > access to DOM nodes from inside) and I need to match EVERY <p> whole tag. > > for whole I mean, starting from the <p and ending with the corresponding > </p>, but such paragrapha MAY (and may not) contain This may not be possible at all. RegExes cannot match nesting pairs, i.e. if your <p></p> contains other <p></p> pairs then you have reached the end of what a RE is capable of. Also due to the way these tags are structured, you need at least negative lookahead for it, which also not all RE engines support. If you do <p.*</p> then the RE would catch from the first <p to the last </p>, hence you need to specify the .* with a lookahead like (?!</p>), or use a non-greedy RE. > a long list of attributes, with or without zero or more \n \r \t > characters, valid, before the >. > (my test is the RegEx engine from KATE Editor with the loaded HTML. > If sb happens to be familiar with RegEx supporting "invisible" > characters ... I'd be very grateful for any hint. This may as well be the problem. Some RE engines treat newline characters as special, i.e. it may be that Kate matches only *within* a line. In short - maybe a RE engine is simply not a good tool to do that. Then use an XML parser instead. Christian
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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