Take this Lorem Ipsum text:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla felis diam, mattis id elementum eget, ullamcorper et purus.
How can I with PHP and regex get everything that comes after Nulla
?
Hmm you don't want to use some simple things like :
$str = substr($lorem, strpos($lorem, 'Nulla'));
if you do not want to look for Nulla, but also for 'null' you might consider using stripos instead of strpos... This code will include Nulla in the returned value. If you want to exclude Nulla, you might want to add it's lentgh to the strpos value i.e
$str = substr($lorem, strpos($lorem, 'Nulla') + 5);
At last, if you need to have something a bit more generic, and as suggested @Francis :
$needle = 'Nulla';
$str = substr($lorem, strpos($lorem, $needle) + strlen($needle));
Honestly regexp are overkill for something like this...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With