It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

regexp find and seperate custom tags in a string

regexp find and seperate custom tags in a string

Postby Chippo on Tue Apr 22, 2008 10:43 pm

Hi
I am working on a CMS system for myself, Im having a bit of trouble with some reg exp.
Say i have a text string like this...
Code: Select all
{{startcontent_categories_box}}blah blah blah<br />
<br />
$p</p>
<table cellspacing="1" cellpadding="1" width="200" border="1">
    <tbody>
        <tr>
            <td>username</td>
            <td>password</td>
        </tr>
        <tr id="rowstart">
            <td style="width: 250px"><strong>$username</strong></td>
            <td style="width: 250px">$userpassword</td>
        </tr>
    </tbody>
</table>
<p><br />
{{endcontent_categories_box}}


what I want to be able to do is run a reg exp which will find things like this on the page for me and seperate the content name, the start and end tags and the content within them.
content name would be 'categories_box'
start tag would be {{startcontent_categories_box}}
end tag would be {{endcontent_categories_box}}
and the content within would be all the html between the 2 tags.

Is this possible?

I have been trying myself but I am useless when it comes to reg exp, what I tried was...
Code: Select all
/{{startcontent_/\d{2,50}/}}(.*?){{endcontent_/\d{2,50}/}}$/mg


If someone could help me with this it would be greatly appreciated
Chippo
 
Posts: 0
Joined: Tue Apr 22, 2008 10:37 pm

Who is online

Users browsing this forum: No registered users and 3 guests