unknownsheep Posted February 13, 2008 Share Posted February 13, 2008 Hello, I've tried to figure this out myself but I guess I'm too dumb.. Anyhow.. I want to replace the character ^ followed by a number from 0-9 with nothing. Examples: ^4Hello becomes Hello ^a1bc^5de becomes ^a1bcde ^P^128 becomes ^P28 Thank you. Link to comment https://forums.phpfreaks.com/topic/90859-simple-regex/ Share on other sites More sharing options...
thebadbad Posted February 13, 2008 Share Posted February 13, 2008 <?php $subject = '^a1bc^5de'; echo $subject, ' becomes '; $subject = preg_replace('|\^[0-9]|', '', $subject); echo $subject; // ^a1bc^5de becomes ^a1bcde ?> Link to comment https://forums.phpfreaks.com/topic/90859-simple-regex/#findComment-465770 Share on other sites More sharing options...
unknownsheep Posted February 13, 2008 Author Share Posted February 13, 2008 Works great, thank you. Link to comment https://forums.phpfreaks.com/topic/90859-simple-regex/#findComment-465799 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.