lucavilla Posted January 15, 2007 Share Posted January 15, 2007 Suppose that we have:$one = "abc123lmn"and we want to extract "123" out of it, with the simple regex [0-9], putting it in a variabile.What's the PHP complete command to do this? Link to comment https://forums.phpfreaks.com/topic/34229-very-simple-question-about-using-regex-in-php/ Share on other sites More sharing options...
effigy Posted January 15, 2007 Share Posted January 15, 2007 [code]<?php $one = 'abc123lmn'; preg_match('/\d+/', $one, $matches); $num = $matches[0];?>[/code] Link to comment https://forums.phpfreaks.com/topic/34229-very-simple-question-about-using-regex-in-php/#findComment-161101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.