Code: Select all
$text="dp12,dp13,dp14,dp1,dp15"; $text = replace ($text, "dp1", "gp1"); text $text;
Could there be a NoAutoWildcards option?
Code: Select all
$text="dp12,dp13,dp14,dp1,dp15"; $text = replace ($text, "dp1", "gp1"); text $text;
OK, no issues.admin wrote:That would be replace with "Whole Words" options. No, that's not available at the moment. But "regexreplace" can probably do it.
Why not:serendipity wrote:I am trying a way to force exact match in SC replace, but as i see it, its not supported. For example this:will replace all "dp1" occurence with "gp1" which results in "gp12,gp13...." but i want exact match.Code: Select all
$text="dp12,dp13,dp14,dp1,dp15"; $text = replace ($text, "dp1", "gp1"); text $text;
Could there be a NoAutoWildcards option?
Code: Select all
$text = replace ($text, ",dp1,", ",gp1,");
Code: Select all
$text = trim(replace (",$text,", ",dp1,", ",gp1,"), ",";
Thanks PeterH! I tried a variation of this yesterday. Just searched for "dp1," and replaced with "gp1,"PeterH wrote:Why not:serendipity wrote:I am trying a way to force exact match in SC replace, but as i see it, its not supported. For example this:will replace all "dp1" occurence with "gp1" which results in "gp12,gp13...." but i want exact match.Code: Select all
$text="dp12,dp13,dp14,dp1,dp15"; $text = replace ($text, "dp1", "gp1"); text $text;
Could there be a NoAutoWildcards option?But: first you must add "," to beginning and end of $text, and at the end strip it again, else occurence in very first and very last position will not be recognized, about:Code: Select all
$text = replace ($text, ",dp1,", ",gp1,");But pay attention: if the very first or very last character is ',' it might get lost? (Didn't test...)Code: Select all
$text = trim(replace (",$text,", ",dp1,", ",gp1,"), ",";
OK: if youserendipity wrote:Thanks PeterH! I tried a variation of this yesterday. Just searched for "dp1," and replaced with "gp1,"
For something i was trying yesterday this worked fine, but you are right, better to cover it all in first go than regret later.PeterH wrote:OK: if youserendipity wrote:Thanks PeterH! I tried a variation of this yesterday. Just searched for "dp1," and replaced with "gp1,"
- don't have an entry named xdp1,
- and if the searched entry is never the last
then it's OK.