相关文章推荐
胡子拉碴的斑马  ·  VIM ...·  1 月前    · 
个性的红酒  ·  如何在使用C++ ...·  1 年前    · 
小眼睛的羊肉串  ·  NoNullAllowedException ...·  2 年前    · 
create table regexp_example( prod_name varchar(10) not null default '', prod_price smallint unsigned not null default 0 )engine myisam character set utf8; # regexp_example表结构说明: # prod_name表示产品名称,prod_price表示产品价格

向regexp_example表中插入数据:

insert into regexp_example values ('HTCN12',1999), ('HTCN250',2899), ('HTCNXP',4999), ('ASHTCN09',999) ('HTCN85',1799);

查询场景:从regexp_example表中查询出所有名称形如"HTCNxx"的产品的信息,"HTCNxx"中结尾处的两个x均指的是在0-9之间的任意一个数字。

实现上述查询任务的SQL语句如下:

select * from regexp_example where prod_name REGEXP '^HTCN.{0}[0-9]{2}$';

查询结果如下图所示:

通俗理解:按照一定的规则,从某个 字符串 匹配 出想要的数据。这个规则就是 正则表达式 。 标准答案:https://baike.baidu.com/item/ 正则表达式 /1700215?fr=aladdin 一个段子: 世界是分为两种人,一种是懂 正则表达式 的,一种是不懂 正则表达式 的。 1. 正则表达式 的常用规则 1.1 匹配 某个 字符串 import... 正则表达式 的语法 1.\w 匹配 所有的阿拉伯数字、英文大小写字母和下划线,\W(大写W) 匹配 被 \w排除在外的字符 2.\d只 匹配 数字,\D 是 匹配 所有不是数字的范围 3.\s 匹配 空白字符:空格、制表符、断行等 ,\S为 \s 的补集 正则表达式 (regular expression)描述了一种 字符串 匹配 的模式(pattern),可以用来检查一个串是否含有某种子串、将 匹配 的子串替换或者从某个串中取出符合某个条件的子串等。 一、 匹配 单个字符: 1). : 匹配 任意除了换行的任意1个字符 2)[]: 匹配 []中列举的字符 3)\d : 匹配 数字0-9 4)\D: 匹配 非数字 5)\s: 匹配 空白 html.replace(reg, value => { console.log(value, 'value') return "<span>" + value + "</span>" soraFont.dll solidcore32.dll SoDalibUpdater.dll sodaliblite.dll SNSImport.dll snd_fmod.dll