1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need a Regex Help here...

Discussion in 'XenForo Development Discussions' started by Fuhrmann, Nov 7, 2011.

  1. Fuhrmann

    Fuhrmann Well-Known Member

    I want to find this:

    PHP:
    <ul class="tabs Tabs" data-panes="#prefixPanes &gt; li">
        <
    li class="active"><class="active">Basic Information</a></li>
        <
    li><a>Forums and Permissions</a></li>
    </
    ul>
    And inside of it, want to insert a new <li>, which means a new tab:

    PHP:
    <ul class="tabs Tabs" data-panes="#prefixPanes &gt; li">
        <
    li class="active"><class="active">Basic Information</a></li>
        <
    li><a>Forums and Permissions</a></li>
        <
    li><a>My new tab</a></li>
    </
    ul>
    Anyone can help me to make a regex to get it the first one?
    I really can not do it.

    Note: There is a bunch of code above and below this little piece of code.
    The template with this code is the admin template thread_prefix_edit.
     
  2. Fuhrmann

    Fuhrmann Well-Known Member

    Annnddd, done! Thank you.
     
  3. infis

    infis Well-Known Member

    Do not share, how you solved this problem?
     
  4. Fuhrmann

    Fuhrmann Well-Known Member

    Yes, I can do it. I just though that was not necessary, since no one replied here.

    Since this template has this piece of code:

    Code:
    <ul class="tabs Tabs" data-panes="#prefixPanes > li">
    <li class="active"><a>{xen:phrase basic_information}</a></li>
    <li><a>{xen:phrase forums_and_permissions}</a></li>
    </ul>
     
    <ul id="prefixPanes">
    
    I just find that this REGEX was more usefull then the other one I was stucked:

    Code:
    (</ul>[^>]*?[^>]<ul id="prefixPanes">)
    With this I can insert a new tab.
    Then, to insert a new content, to this tab, I look for this:

    Code:
    </ul>
     
    <xen:submitunit save="{xen:phrase save_thread_prefix}">
    
    This </ul> means: 'all the others tabs ends here'. So, I used this REGEX:

    Code:
    </ul>[^>]*?[^>]<dl class="ctrlUnit submitUnit">)
    And then I was able to insert a new tab and a new <li> to put the content of this tab.
     
    infis likes this.

Share This Page