how can I replace who string with certain beginning and ending, for example I have string:
abc........xyz

I want to replace this string with "this is a test", no matter what text in between, only "abc" and "xyz" are fixed.

abc123xyz-->this is a test
abcd1234xyz-->this is a test

any idea?

Simple PHP should do it if you do not know regular expressions.

$string = "abcd123xyz";

if((substr($string,0,3)=="abc") && (substr($string,-3)=="xyz"))
{
  $string = "this is a test";
}

echo $string;

There are many ways, but i agree with top dogger, the above is the most simplest and works effectivly :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.