P
P
pevec12015-09-23 21:17:20
JavaScript
pevec1, 2015-09-23 21:17:20

How to compose a regular expression for javascript?

Help, pliz, compose a regular expression to highlight the following block of code from the entire page (the code is large):

<div class="box" id="customer-login"><div class="bl-2">...</div>...</div>

No matter how you try it, it doesn't work.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DevMan, 2015-09-23
@pevec1

something like this https://regex101.com/r/vU8mY2/1

S
Sergey, 2015-09-23
@goodwin74

If you want to highlight the form
Then so -

/<div class="box" id="customer-login"[а-я\s\w="();:/\-><|]+<\/form>[\s]<\/div>/igm

P
pevec1, 2015-09-23
@pevec1

you should get something similar to this:

<div id="promo">
<div class="left_promo">
      <div class="bl-2">Гарантия качества</div>
      <p>Мы продаем качественные интернет-магазины и гарантируем, что вы останетесь довольны нашими продуктами.</p></div>
<div class="center_promo">
<div class="bl-2">Заказ прямо сейчас</div>
<div class="timer">
                    <p>До конца акции</p>
                    <div class="digits"></div>
                </div>
</div>
<div class="right_promo">
<div class="bl-2">Быстрые скидки!</div>
<p>Условия акции:</p></div>
</div>
<div id="main_all">
<div class="left_packet_one" id="abs">
<!-- Paypal cart <div id="adding" class="view-cart">
            <form target="_self" method="post"
             action="{$smarty.const.PAYPAL_URL}">
              <input type="hidden" name="cmd" value="_cart" />
              <input type="hidden" name="business"
               value="{$smarty.const.PAYPAL_EMAIL}" />
              <input type="hidden" name="display" value="1" />
              <input type="hidden" name="shopping_url"
               value="{$obj->mPayPalContinueShoppingLink}" />
              <input type="hidden" name="return"
               value="{$smarty.const.PAYPAL_RETURN_URL}" />
              <input type="hidden" name="cancel_return"
               value="{$smarty.const.PAYPAL_CANCEL_RETURN_URL}" />
              <input type="submit" name="view_cart" value="Корзина" />
            </form>
          </div>
-->
<div id="logining">
<div class="box" id="customer-login">
  <div class="bl-2">Авторизация</div>
  <form id="customer" name="customer" method="post"  OnSubmit="sendRequestLogin(); return false" action="http://tshirt/customer-login/">
        <p>
      <label for="email">E-mail адрес:</label>
      <input type="text" maxlength="50" name="email" size="22"
       value="" />
    </p>
    <p>
      <label for="password">Пароль:</label>
      <input type="password" maxlength="50" name="password" size="22" />
    </p>
    <p>
      <input type="submit" name="Login" value="Войти" /> |
      <a href="http://tshirt/register-customer/">Зарегистрироваться</a>
    </p>
  </form>
</div>_

</div>
<div id="adding">
<div class="box" id="cart-summary">
  <div class="bl-2">Корзина</div>
  <div id="updating">Обновление...</div>
<form class="cart-form2" method="post" target="_self" action="http://tshirt/index.php?CartAction=1&amp;ItemId=&amp;IdQuantity=0" onsubmit="return executeCart(this);">
  <table class="tss-table">
    <tbody>
         <tr>
        <td width="30" valign="top" align="right">
        <input name="itemId[]" type="hidden"
         value="36144" />
          1 x 
        </td>
        <td>
        <input type="hidden" name="quantity[]"
         value="1" />
          Chartres Cathedral (Размер/Цвет: S/Белый)
        </td>
      </tr>
        <tr>
        <td colspan="2" class="cart-summary-subtotal">
          <span class="price">15.95 руб.</span>
          <span>
            [ <a href="http://tshirt/cart-details/">Смотреть детали</a> ]
          </span>
        <input type="submit" name="update2" value="Обновить" />
        </td>
      </tr>
    </tbody>
  </table>
  </form>
</div>
</div>
</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question