Home - development tool
 Collection

Online regular testing and generation

 
 

在线代码测试以下正则立刻使用-GOGO..

javascript语言正则:
var input='998989891212';
var regex_e=/[0-9]/ig;
var content = input.match(regex_e);
console.log(content);
                        
PHP语言正则:
$input = '156454asdasd645';
$pat = "/[0-9]/si";
preg_match_all($pat, $input, $array);
var_dump($array);
//结果 array(1) { [0]=> array(9) { [0]=> string(1) "1" [1]=> string(1) "5" [2]=> string(1) "6" [3]=> string(1) "4" [4]=> string(1) "5" [5]=> string(1) "4" [6]=> string(1) "6" [7]=> string(1) "4" [8]=> string(1) "5" } }
                        
Python语言正则:
# -*- coding:utf-8 -*-
import re  # 正则模块
data = '内容123456789qwertyuiop'
result = re.findall(r'\d',data)
print result  # result出来的结果是一个列表 如果没匹配到就是一个空的列表
                        

Tool description:

Regular expressions are logical formulas for string operations. They consist of a "regular string" which is used to express a filtering logic for strings, using pre-defined specific characters and combinations of these specific characters.

Recommendation tool:

Tool label:

testregular