Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Special string matching

Status
Not open for further replies.

Sleidia

Technical User
May 4, 2001
1,284
0
0
FR
Hello again,

Sorry for asking another question today, but
I would like to know what function I should use
in order to match a string surounded by certain characters.

Thus, if $string="wow, this is a #funny! string.",
$matched_string would be "funny".

As usual, thanks to you all.
 
Don't know if it's helpful but, probably, if you know the characters position you could use substr_replace:

es: $var = 'ABCDEFGH:/MNRPQR/';

//This example replace 'MNRPQR' in $var with 'bob'

echo substr_replace($var, 'bob', 10, -1);
bye
 
Dear Erikk,

Thanks you for helping.
Unfortunately, in this case, I can't know
the character position.
That's why I have to use such a trick wich is
quite difficult to code considered I am not a
"god like" coder at all.

Thanks again.
 
Dear Anikin,

In fact, I've used a different approach because
I didn't manage to do it with regular expressions.

This is where you will see what I've done:
thread434-205364 anyway.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top