Conditional look-ahead?

Discussion in 'Perl Misc' started by Steve Dunn, Oct 29, 2003.

  1. Steve Dunn

    Steve Dunn Guest

    I'm stuck with a regular expression that closes tags if a closing tag
    doesn't already exist. It's probably easier to demonstrate than explain, so
    here goes:

    I need to turn the following structure:

    <TAG3>I'm ok</TAG3>

    into the follow:

    <TAG3 />

    So, TAG1 and TAG3 are left alone, as they contains a closing tag, TAG2 is
    closed because there's text and no closing tag, and <FOOBAR> is closed
    because there's no text and closing tag.

    Any help very much appreciated,


    p.s. I'm using the .NET regex classes
    Steve Dunn, Oct 29, 2003
    1. Advertisements

    Hash: SHA1

    So, then, your asking in a perl group why?

    Try a .NET group.

    - Brian
    Version: GnuPG v1.2.2 (GNU/Linux)

    -----END PGP SIGNATURE-----
    Brian Harnish, Oct 29, 2003
    1. Advertisements

  3. Steve Dunn

    Ben Morrow Guest

    Not wishing to cause trouble or anything, but is it *really* necessary
    to sign a message which is itself shorter than the signature?

    Ben Morrow, Oct 29, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.