Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
P is for Practical
 
PerlMonks  

Re: Using regexps to parse an XML DTD file

by the_slycer (Chaplain)
on Nov 26, 2000 at 01:54 UTC ( [id://43338]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Using regexps to parse an XML DTD file

Not what I would do ($1 is not neccesarily a good thing ;-)), but here's some code that works, note that it's not all a regex :-)
$string = "<!ELEMENT ORDER (NAME,DELIVERY,PAYMENT,ORDERNUMBER)>"; $string =~ m/\((.*)\)/; @array = split (/,/,$1); foreach (@array){print "$_\n"}

Replies are listed 'Best First'.
Re: Re: Using regexps to parse an XML DTD file
by Leitchn (Acolyte) on Nov 26, 2000 at 02:09 UTC
    Excellent, thanks - out of interest though, can it be done with a single regexp?

    Nick.
      A single regex cannot generate a variable number of backreferences. What do you think this is, Java? 1{grin}

      -- Randal L. Schwartz, Perl hacker

      1The Java regex library I saw caused /(\w+)\s+)+/ to generate a variable number of backreferences, making it impossible to know exactly what part of the match you were looking at. Evil. They just don't get it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://43338]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.