Good day.
I want to create a small app that would take out the content from a rss feed and posteriorly from the url .
I know that would be easily done in perl with regular expressions, but in php it seams a bit more difficult.
So i want to translate the next querry from perl to php :

$mystring="startABCend";
if($mystring =~ m/start(.*)end/) {
	print $1;
}

Basically what it does is selecting any string from the middle of the string, so it would show "ABC".
Thanks in advance.

Recommended Answers

All 2 Replies

Good day.
I want to create a small app that would take out the content from a rss feed and posteriorly from the url .
I know that would be easily done in perl with regular expressions, but in php it seams a bit more difficult.
So i want to translate the next querry from perl to php :

$mystring="startABCend";
if($mystring =~ m/start(.*)end/) {
	print $1;
}

Basically what it does is selecting any string from the middle of the string, so it would show "ABC".
Thanks in advance.

http://php.net/preg_match

$string = 'startABCend';
if (preg_match('/start(.*)end/', $string, $matches)) {
  echo $matches[1];
}

Thanks for help.

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.