Regex fun - nested "tags". (x-posted to linux)

    Date: 01/25/07 (PHP Community)    Keywords: php, web

    I am still learning Regex's so doing crafted complicated patterns is just a little bit out of my reach.

    What I am trying to do:
    Messing around with different output handling schemes for a webscript. The logic I am using is that at the end output would be broken down into blocks. So inner most tags would all be appended to a buffer of that tagName. So at the end of script execution I might have 2+ buffers of names like system,application,template, etc that I can then handle. One of the justifications for investing time in this is to come up with some sort of sectionized caching system (so everything is rendered previously except say 1 small section). Otherwise if regex can't do this fast enough, another thought was to "improve" the PHP output buffering system.


    What I got: '(?:%OB_(?P[A-Z]*)%\n?(?P.*)\n?%/OB_\1%)'
    Mode: Single-Line
    Engine: PHP/PRCE

    Test data:

    %OB_SYS%
    System started: 0492
    Good to go!
    %OB_APP%
    
        
     This is a test
        
        
     %OB_TEMP%
     Hello world!
     This
     is
     a
     test
     %/OB_TEMP%
        
    
    %/OB_APP%
    System closing up
    %/OB_SYS%
    

    Source: http://community.livejournal.com/php/533258.html

« refresh || __autoload() function »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home