• Resolved ascentryan

    (@ascentryan)


    So in php, this code works for finding a specific url, while avoiding any instance where there’s children pages in the url, and replacing it:

    $str = [];
    $str[0]  = 'https://www.ascentfunding.com/college-loans/for-students/faqs/';
    $str[1]  = '"/college-loans/for-students/"';
    $str[2]  = '"https://www.ascentfunding.com/college-loans/for-students"';
    $str[3]  = 'https://www.ascentfunding.com/college-loans/for-students';
    $str[4]  = '"https://www.ascentfunding.com/college-loans/for-students/faqs/"';
    for ($i=0; $i<=4; $i++)
    {
        $str[$i] = preg_replace('/["]*^(.*)\/college-loans\/for-students(["\/]*)$/', '\1/bright-futures\2', $str[$i]);
        echo "str after replace:", $str[$i], "\n";
    }

    But when I try to use the search regex plugin to search for:

    ‘/[“]*^(.*)\/college-loans\/for-students([“\/]*)$/’

    I get no results. I know there are instances of /college-loans/for-students/ within href values – does this plugin not allow the ‘$’ ?

    • This topic was modified 2 years, 7 months ago by ascentryan.
    • This topic was modified 2 years, 7 months ago by ascentryan.
Viewing 1 replies (of 1 total)
  • Plugin Author John Godley

    (@johnny5)

    You are not supposed to match what you do in PHP – just enter the regular expression without surrounding delimiters.

Viewing 1 replies (of 1 total)
  • The topic ‘Search query not working with $’ is closed to new replies.