Moved by moderator to Regex forum.
Hello
$nametitle = "15658'>Tattoo funny cool</a></td><";
how can i remove these tags
</a></td><
and
'>
then how to get the out put as
15658
Tattoo funny cool
need help!
Regular expression
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Regular expression
Regex not required. Take a look at strip_tags()
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: Regular expression
A bit of an old thread, but here's a possible way to do it. As already mentioned, the tags can be removed by using the built-in strip_tags function. After doing so, you can split the string with a regex:
The last parameter, the number two, will cause the split function to split the target string in no more than two sub-strings.
Code: Select all
$nametitle = "15658'>Tattoo funny cool</a></td><";
$tokens = preg_split("/[\"'<>]+/", strip_tags($nametitle), 2);
print_r($tokens);Re: Regular expression
regular expression for the only strings that are not generated over {a,b} by the expression (a+ b)* a (a+b)*
reasoning please
reasoning please
Re: Regular expression
Write a regular expression for strings that contain atleast one a and one b. show that its capable of generating the strings :
(i) aabbbabaa
(ii) bbbbaaa
(i) aabbbabaa
(ii) bbbbaaa
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: Regular expression
As I suggested three times now: create your own thread instead of hijacking other people's thread.piyushj wrote:Write a regular expression for strings that contain atleast one a and one b. show that its capable of generating the strings :
(i) aabbbabaa
(ii) bbbbaaa