• Resolved loops

    (@loops)


    In the previous version I used the following regex to find links followed by a / and a string of text:
    [</a> / [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890](.*)]

    In version 2.0 this produces another result, with matches including:

    <li>Elegant windowing of the data on input and ouput ahead of the 8-way temporal overlap. The window used is w[n]
    <li>Unit Converter : added MIDI 7bit to/from [0,1]
    A manual of the original Prophet-5 is also available: <del datetime="2006-10-31T11:55:21+00:00">[https://www.ele4music.com/vst/p5_manual.zip]
    <span class="keyword">Liquid Guitar</span> unites the collected power of the guitar universe. <a href="https://www.ueberschall.de/index.php?id=showproduct&user_uschall_pi1[showUid]
    <blockquote>Tank-FX is a non-virtual effect device. The reverb is generated by a huge [11m]

    What kind of regex do I need to use instead to get the intended result?

    • This topic was modified 4 years, 10 months ago by loops.
    • This topic was modified 4 years, 10 months ago by loops.
Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author John Godley

    (@johnny5)

    I don’t understand your original regex, and I don’t know what intended result you are expecting.

    Regular expressions are all standard PHP regular expressions.

    Thread Starter loops

    (@loops)

    The original regex searched for patterns matching:
    </a> / sometext

    When using the exact same regex I now get results like the ones I mentioned in the previous post. Did something change with regards to delimiters maybe?

    Plugin Author John Godley

    (@johnny5)

    I can’t comment on your original expression and I don’t know what in your original message is being matched. You may need to include a screenshot

    If I search for </a> / \w* (an </a> tag followed by / followed by some word) then it matches as expected.

    Delimiters are not needed.

    Thread Starter loops

    (@loops)

    I tried </a> / \w+ instead because otherwise it also matches no words after the /, but unfortunately the search crashes, likely due to it taking too long to complete with 123,460 database rows to search.

    Something went wrong ??
    
    Search Regex is not working. Try clearing your browser cache and reloading this page.  If you are using a page caching plugin or service (CloudFlare, OVH, etc) then you can also try clearing that cache.
    
    If that doesn't help, open your browser's error console and create a new issue with the details.
    
    Please mention search, and explain what you were doing at the time
    
    Plugin: 2.0
    WordPress: 5.4.1 (single)
    PHP: 7.3.17
    Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0
    JavaScript: https://---/wp-content/plugins/search-regex/search-regex.js
    REST API: https://---/wp-json/
    Buster: 2.0 === 2.0
    
    TypeError: a.message is undefined
    
        in Ea
        in div
        in div
        in a
        in f
        in div
        in a
        in f
        in StrictMode
        in H
        in ji

    At this point I think I’ll just revert to the previous version since that works fine for me as long as I set a limit to the amount of records to be searched.

    Plugin Author John Godley

    (@johnny5)

    The search is not looking through 123,460 rows – it doesn’t work like that anymore, and there is no need for limits.

    The error is something else. Although you are free to use an older version, it won’t help solve the problem. If you can open your browser’s developer console and see if any other information is shown there then it may help.

    Thread Starter loops

    (@loops)

    I’m not familiar enough with regex to rebuild the regex patterns I was using in the previous version unfortunately.

    With </a> / \w+ which should work just fine the console shows a bunch of successful XHR GET, with the last one being the following (I’ve replaced my website address with —)

    https://---/wp-json/search-regex/v1/search/?searchPhrase=https%3A%2F%2F---%2Fproduct%2F&searchFlags%5B0%5D=case&searchFlags%5B1%5D=regex&source%5B0%5D=posts&perPage=25&page=2500&searchDirection=forward&_wpnonce=cda8f26d47

    Every time I try it chokes after page=2500

    Then this shows:

    undefined search-regex.js:55:57309
        message https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:55
        c https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:6
        g https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:6
        tt https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:55
        Ee https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:55
        onSetError https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:55
        Ao https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:55
        ol https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        gu https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        unstable_runWithPriority https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:35
        Bo https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        mu https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        hu https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        z https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:35
        onmessage https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:35
    
    TypeError: "a.message is undefined"
        Ea https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:55
        Ga https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        gl https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        cu https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        lu https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        Zl https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        Qo https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        unstable_runWithPriority https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:35
        Bo https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        Qo https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        qo https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        gu https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        unstable_runWithPriority https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:35
        Bo https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        mu https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        hu https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:27
        z https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:35
        onmessage https://---/wp-content/plugins/search-regex/search-regex.js?ver=2.0-32f788d37fc2989dee637ada18b75ef4:35
    search-regex.js:27:82383
    Plugin Author John Godley

    (@johnny5)

    Ok, I will look into that error and see if I can discover the problem. There should be no need to rebuild your expressions – the old and new version use the same PHP regular expression system.

    This does not look like it will match anything: [</a> / [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890](.*)]

    Thread Starter loops

    (@loops)

    I’ve been using that pattern for years, it works fine. You can see the result here https://pasteboard.co/J7A7CgH.png

    Plugin Author John Godley

    (@johnny5)

    The screenshot doesn’t work so I can’t check there.

    The expression, as shown above, does not work for me in the old Search Regex, and does not work on https://regex101.com. Unless you’ve copy/pasted it wrong here I don’t see how the nested square braces could work.

    Thread Starter loops

    (@loops)

    I can assure you it works on 1.4.16. As far as I remember I never modified any of the files of that version except adding a few list options to the search limit as I mentioned earlier.

    The pattern works fine with [] delimiters, as it does with others like %, @, and also /<\/a> \/ [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890](.*)/

    I hope you can figure out why the new version stops after the page=2500, then maybe I can figure out what I’m doing wrong with the regex. Thanks!

    Plugin Author John Godley

    (@johnny5)

    Oh, those are delimiters? Ok. As I said, the new version doesn’t need those. They are not part of the regular expression and shouldn’t be included in the new version. If you do include them in the new version then the results will be very different from what you expect.

    Plugin Author John Godley

    (@johnny5)

    Adding that version 2.0.1 was released which should help with the error mentioned above.

    Thread Starter loops

    (@loops)

    Maximum number of page requests has been exceeded and the search stopped. Try to be more specific with your search term.

    This happened after `XHR GET https://—/wp-json/search-regex/v1/search/?searchPhrase=%3C%2Fa%3E%20%2F%20%5BabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890%5D%28.%2A%29&searchFlags%5B0%5D=case&searchFlags%5B1%5D=regex&source%5B0%5D=posts&perPage=25&page=12500&searchDirection=forward&limit=25&_wpnonce=9e6d4f1951
    [HTTP/2 200 OK 1987ms]`

    Each GET takes about 1 to 2 seconds, so I had to wait 12 minutes and it did not show any results. Not sure whether the records that match the pattern were checked or not yet.

    In comparison, the previous version takes about 1 second to complete and does show the results, though I do limit it to search maximum of 25k records.

    • This reply was modified 4 years, 10 months ago by loops.
    Plugin Author John Godley

    (@johnny5)

    The old version will cause memory errors, timeouts, and will likely max your server CPU. It is not a good way of searching. The new version won’t do this because it takes more time and paginates correctly.

    The message is expected if it doesn’t find any results after a set number of requests. I am surprised you exceeded this and it seems you are looking for something that is at the end of your database. I will look into improving this.

    The limit in the old version means you are not searching your entire database.

    Plugin Author John Godley

    (@johnny5)

    Would it be at all possible to get an export of the data you are searching? I have tested this on a large set of data, however people use the plugin in different ways and this makes it hard to test for. It would help to be able to repeat what you are doing. If this is ok then I can be contacted at https://searchregex.com/contact/

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Regex format’ is closed to new replies.