Here's mine:

=====================

procedure rmembeds(tag)

  local opentag, closetag, nestlvl, outline

  opentag := "<" || tag || ">"
  closetag := "</" || tag || ">"
  nestlvl := -1
  outline := ""

  suspend !&input ? {
    
    while outline ||:= tab(find("<")) do {
      
      outline ||:=
        if =opentag then {
          nestlvl +:= 1
          (nestlvl <= 0, opentag) | ""
        } else if =closetag then {
          nestlvl -:= 1
          (nestlvl < 0, closetag) | ""
        } else {
          move(1)
        }
    }

    outline ||:= tab(0)
    
  } do outline := ""

end

procedure main(cmdl)

  every write(rmembeds(get(cmdl)))

  exit()

end

===========================

test input:

<x>This is item 1. <x>This is item 2.</x> This</x> is <x>item
<x>3</x>.</x>
<x>This is a <k>relation <x>a<x<y<z></x> isn't it</x></z>

test output:

<x>This is item 1. This is item 2. This</x> is <x>item
3.</x>
<x>This is a <k>relation a<x<y<z> isn't it</x></z>

--

Michael Borek "Death before Dishonour; Beer before Lunch"

__________________________________________________________________
Introducing the New Netscape Internet Service. 
Only $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need. 

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to