tenants
Well-known member
Hello, this might be a misunderstanding by me, or a xenforo regex match bug (it's more likely to be the former)
I'm trying to use a non greedy regex match for the template registration_form
I'm just trying to find this:
from this:
I've used a non greedy expression:
But what this seems to do is get the largest match from left start, so this:
Is there something wrong with the way I'm using this regular expression (is it not greedy, since I'm ending in ?), or is this a xenforo bug?
I'm trying to use a non greedy regex match for the template registration_form
I'm just trying to find this:
Code:
<dl class="ctrlUnit">
<dt><label for="ctrl_email">Email:</label></dt>
<dd><input type="email" name="email" value="" dir="ltr" class="textCtrl" id="ctrl_email" /></dd>
</dl>
from this:
Code:
<dl class="ctrlUnit">
<dt><label for="ctrl_username">Name:</label></dt>
<dd>
<input type="text" name="username" value="" class="textCtrl" id="ctrl_username" autofocus="true" autocomplete="off" />
<p class="explain">This is the name that will be shown with your messages. You may use any name you wish. Once set, this cannot be changed.</p>
</dd>
</dl>
<dl class="ctrlUnit">
<dt><label for="ctrl_email">Email:</label></dt>
<dd><input type="email" name="email" value="" dir="ltr" class="textCtrl" id="ctrl_email" /></dd>
</dl>
<fieldset>
<dl class="ctrlUnit">
<dt><label for="ctrl_password">Password:</label></dt>
<dd><input type="password" name="password" class="textCtrl OptOut" id="ctrl_password" autocomplete="off" /></dd>
</dl>
<dl class="ctrlUnit">
<dt><label for="ctrl_confirm_password">Confirm Password:</label></dt>
<dd>
<input type="password" name="password_confirm" class="textCtrl OptOut" id="ctrl_confirm_password" />
<p class="explain">Enter your password in the first box and confirm it in the second.</p>
</dd>
</dl>
</fieldset>
I've used a non greedy expression:
Code:
#<dl([\S\s].+?)>([\S\s].+?)(id="ctrl_email")([\S\s].+?)/dl>#s
But what this seems to do is get the largest match from left start, so this:
Code:
<dl class="ctrlUnit">
<dt><label for="ctrl_username">Name:</label></dt>
<dd>
<input type="text" name="username" value="" class="textCtrl" id="ctrl_username" autofocus="true" autocomplete="off" />
<p class="explain">This is the name that will be shown with your messages. You may use any name you wish. Once set, this cannot be changed.</p>
</dd>
</dl>
<dl class="ctrlUnit">
<dt><label for="ctrl_email">Email:</label></dt>
<dd><input type="email" name="email" value="" dir="ltr" class="textCtrl" id="ctrl_email" /></dd>
</dl>
Is there something wrong with the way I'm using this regular expression (is it not greedy, since I'm ending in ?), or is this a xenforo bug?
Last edited: