hello all,
I have a string which has a number in it.
What I need is the substring that comes after the number.
for example:
hello-99goodbye.txt
I need to output => goodbye.txt
I'm guessing it's perl but I'm quite new at this.
Thank you all.
get a substring
Moderator: General Moderators
Code: Select all
<?php
$text = 'hello-99goodbye.txt';
if (preg_match('!\d+(.*)$!', $text, $match))
echo $match[1];
else
echo 'no match';
?>Yes, perl comes in handy sometimes
I guess that will work.
Code: Select all
$array = preg_split("|[\d]+|",$text);
// the last element in that array should be the goodbye.txt