'Smarty substring after last occurrence?
Need to get the style number out of text string:
'The style number is A456RT' 'Style A456RT' 'Style number is A456RT'
Need to get the A456RT part only, i.e. after the last space. Tried to adapt similar answers but no luck:
{$product.name|regex_replace:"/^\d+ /":""}
Is there an easy way to achieve this?
Solution 1:[1]
How about the much simpler:
/[^ ]+$/gm
That is...
[^ ] any character other than a space
+ One or more times
$ at the end of the line
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Djave |
