English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

how can you strip the text between search mark, for example"
=======================
WORDS
=======================
how can i strip the text from the string that is contained in the "" and "" tags?..

2007-12-24 13:44:28 · 2 answers · asked by truepal20032001 2 in Computers & Internet Programming & Design

2 answers

You can use a regular expression and preg_match.

$haystack = "WORDS";
$pattern = "/(<.*>)(.*)()/";
$return = preg_match($pattern, $haystack);

$return will be a four-cell array. $return[0] contains all of $haystack. $return[1] contains , $return[2] contains WORDS. $return[3] contains .

http://us.php.net/manual/en/function.preg-match.php

2007-12-24 13:54:31 · answer #1 · answered by Anonymous · 1 0

I agree with dhvrm and also you need
to be careful on using the regexp in
non-greedy mode.

2007-12-25 15:40:52 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers