Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try the regex </p> <pre><code>$regex = '/(&lt;a href="([^"]+)\.jpg")[^&gt;]*&gt;/iU'; </code></pre> <p>And replace with '\1>'.</p> <p>Notes:</p> <ul> <li>Removed the escape in front of the "; not necessary (although you can leave them in if you want, it doesn't mak a difference)</li> <li>Added an explicit <code>\.jpg</code> just before the last <code>"</code> to only match links ending with <code>.jpg</code>. You might consider <code>\.jpe?g</code> to allow '.jpeg' as well as '.jpg' (although the former is not that common)</li> <li>Added a <code>[^&gt;]*</code> before the <code>&gt;</code> of the first <code>&lt;a href=...&gt;</code> to allow for optional extra attributes like <code>name="asdf"</code></li> <li>Added capturing brackets around the <code>(&lt;a href="xxx")</code> bit so that I can <em>replace</em> with <code>\1&gt;</code> (hence stripping out all the extra attributes). </li> </ul> <p><strong>Re a regex generating tool</strong>, I don't know of any that <em>generate</em> regex. I think your best bet is to learn regex yourself and then use an interactive tester to quickly develop it.</p> <p>I highly recommend <a href="http://regexr.com?30hra" rel="nofollow">regexr.com</a>.</p> <p>If you follow that link you'll see exactly the regex I entered in and some test data to play around with it.</p> <p>Then you can play around wth the regex and see the results in real-time -- it's very helpful for fast development of regexes.</p> <p>(Although, regexr.com does not offer the ungreedy 'U' tag; just convert all <code>+</code> to <code>+?</code> and <code>*</code> to <code>*?</code> in the regex to simulate this).</p>
    singulars
    1. This table or related slice is empty.
    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.
    3. VO
      singulars
      1. This table or related slice is empty.
    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