I'm trying to create a regex which will create html out of markup code.
When trying to replace a part of the [table] markup, it only replaces the last occurence.
I have the following regex (PHP):
/(\[table].*)\[\|](.*\[\/table])/s
Replace pattern:
$1</td><td>$2
And the following test string:
[table]<thead>
<th>head1</th><th>head2</th></thead>
[*]test1[|]test2
[*]test1[|]test2
[/table]
It should produce the following:
[table]<thead>
<th>head1</th><th>head2</th></thead>
[*]test1</td><td>test2
[*]test1</td><td>test2
[/table]
but it actualy procudes this:
[table]<thead>
<th>head1</th><th>head2</th></thead>
[*]test1[|]test2
[*]test1</td><td>test2
[/table]
The problem with that is, that [|] is used in other markup codes to but should not be replaced with </td><td>
To clarify: I have a table "bb-code"
[table]
[**]header1[||]header2[||]header3[||]...[/**]
[*]child1.1[|]child1.2[|]child1.3[|]...
[*]child2.1[|]child2.2[|]child2.3[|]...
[*]child3.1[|]child3.2[|]child3.3[|]...
[*]...[|]...[|]...[|]...
[/table]
I want this to become this:
<table class="ui compact stripet yellow table">
    <thead>
        <tr>
            <th>header1</th>
            <th>header2</th>
            <th>header3</th>
            <th>....</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>child1.1</td>
            <td>child1.2</td>
            <td>child1.3</td>
            <td>...</td>
        </tr>
        <tr>
            <td>child2.1</td>
            <td>child2.2</td>
            <td>child2.3</td>
            <td>...</td>
        </tr>
        <tr>
            <td>child3.1</td>
            <td>child3.2</td>
            <td>child3.3</td>
            <td>...</td>
        </tr>
    </tbody>
</table>
 
    