Last active
December 28, 2015 02:19
-
-
Save ihsanberahim/7426940 to your computer and use it in GitHub Desktop.
search money in text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$subject = ' | |
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test | |
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test | |
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test | |
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test | |
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test | |
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test | |
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test | |
'; | |
$pattern = '/RM+[0-9\s\,\.]*/x'; | |
preg_match_all($pattern,$subject,$matches,PREG_SET_ORDER); | |
$result = array(); | |
foreach($matches as $key => $value){ | |
$result[] = trim(current($matches[$key])); | |
} | |
var_dump($result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment