Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You're close, you need to have it handle any number of spaces after your initial <code>&lt;</code>, and handle if it doesn't have any space at all.</p> <p>Using your <a href="http://rubular.com/r/mYLG0C5CVV" rel="nofollow">example</a>, you can use the regex <code>&lt;\s*(br|BR|bR|Br|br)&gt;</code> to have it accept the <code>0 to N</code> spaces before your BR works. You can also simplify it a little bit more by making it case insensitive with <code>i</code>, which allows for a cleaner looking regex to handle all the variations on <code>BR</code> you will see. <a href="http://rubular.com/r/99EWNZnWDY" rel="nofollow">To do that</a>, use <code>(?i)&lt;\s*br&gt;</code>.</p> <p>I think for completeness you can also include an arbitrary amount of space AFTER the <code>br</code>, just to handle anything that could be thrown. I agree with adding in some sort of catch for a <code>/&gt;</code> to end the pattern, since <code>&lt;br/&gt;</code> is valid HTML as well. It makes the regex look a little more <a href="http://rubular.com/r/SqxhLInAh4" rel="nofollow">crazy</a>, but it boils down to just adding the other 3 pieces.</p> <p><code>(?i)&lt;\s*br\s*\/?\s*&gt;</code></p> <p>It looks really scary, but breaks down very simply into a few parts:</p> <ol> <li><code>(?i)</code> turns on case insensitive to handle the variations on the <code>br</code>. </li> <li><code>&lt;\s*</code> is the start of the tag directly followed by an arbitrary number of spaces.</li> <li><code>br\s*</code> is your <code>br</code> chars followed by an arbitrary number of spaces.</li> <li><code>\/?</code> is to handle 0 or 1 instances of the closing slash (to handle HTML valid tags like <code>&lt;br/&gt;</code> and <code>&lt;br&gt;</code>.</li> <li><code>\s*&gt;</code> is handling an arbitrary number of spaces and then the closing <code>&gt;</code>.</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload