Support » Plugin: Remote Content Shortcode » Regex not working

  • Resolved neuquen7

    (@neuquen7)


    I’m attempting to use the find= and replace= attributes in the shortcode in order to remove links from the text, but it doesn’t seem to work. I’ve tested my regex here and it doesn’t look like the regex is the problem.

    Here is my code:

    find="/<a\shref=\"(.*?)\">(.*?)<\/a>/igs"
    replace="$2"

    Do I have to use the tilde (~) delimiter? Can I not use modifiers?

    https://wordpress.org/plugins/remote-content-shortcode/

Viewing 1 replies (of 1 total)
  • Plugin Author doublesharp

    (@doublesharp)

    It’s likely breaking on the double quotes in your pattern since the attribute is wrapped in double quotes and can’t be escaped with a backslash (it just passes the backslash to the shortcode). Try using the special pattern %QUOT% to match the double quotes.

    find="/<a href=%QUOT%(.*?)%QUOT%>(.*?)<\/a>/igs"
Viewing 1 replies (of 1 total)
  • The topic ‘Regex not working’ is closed to new replies.