Ansel_Tk1 Posted October 27, 2008 Share Posted October 27, 2008 Hi - I am way out of my league here. If you are willing to help I appreciate it. I will pay a little $ for your help as well - email me at [email protected] with how much and I will let you know. Here is the question: I have strings like this in a field: BASE;Price-$231;231.00 And I need the string returned with only the amount AFTER the LAST semi-colon. i.e: 231.00 Your help is GREATLY appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/130283-preg_replace-help-needed-for-wildcard/ Share on other sites More sharing options...
.josh Posted October 27, 2008 Share Posted October 27, 2008 $string = "BASE;Price-$231;231.00"; $temp = explode(";",$string); $val = end($temp); edit: No payment necessary, but if you insist....become a subscriber, get some bling! Quote Link to comment https://forums.phpfreaks.com/topic/130283-preg_replace-help-needed-for-wildcard/#findComment-675622 Share on other sites More sharing options...
Ansel_Tk1 Posted October 27, 2008 Author Share Posted October 27, 2008 Thank you Crayon - I think I will become a subscriber! One thing about your code - the price is not always $231.00, but in all cases it is what comes after the last semi-colon that I want to retain. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/130283-preg_replace-help-needed-for-wildcard/#findComment-675636 Share on other sites More sharing options...
.josh Posted October 27, 2008 Share Posted October 27, 2008 Yeah $string is just example of what you showed. It doesn't matter what the price is. Code explodes at the semicolons and grabs the last value in the exploded array, so assuming that the actual format of the string stays the same (semicolon followed by value), you should get what you need. Quote Link to comment https://forums.phpfreaks.com/topic/130283-preg_replace-help-needed-for-wildcard/#findComment-675639 Share on other sites More sharing options...
The Little Guy Posted October 27, 2008 Share Posted October 27, 2008 No payment necessary, but if you insist....become a subscriber, get some bling! Link is broken Quote Link to comment https://forums.phpfreaks.com/topic/130283-preg_replace-help-needed-for-wildcard/#findComment-675641 Share on other sites More sharing options...
.josh Posted October 27, 2008 Share Posted October 27, 2008 No it's not. It links directly to his profile > paid subscriptions. It doesn't work for you because you don't have access to his personal paid subscriptions. Quote Link to comment https://forums.phpfreaks.com/topic/130283-preg_replace-help-needed-for-wildcard/#findComment-675650 Share on other sites More sharing options...
Ansel_Tk1 Posted October 27, 2008 Author Share Posted October 27, 2008 Crayon - your code worked great and I appreciate your help. Thank you very much. Quote Link to comment https://forums.phpfreaks.com/topic/130283-preg_replace-help-needed-for-wildcard/#findComment-675658 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.