当前位置: 首页 > news >正文

怎么做网站弹出公告新手20种引流推广方法

怎么做网站弹出公告,新手20种引流推广方法,wordpress拖拽编辑插件,小程序开发平台的设计是实现1.定义正则表达式 正则表达式意在描述隐藏在数据中的某种模式或规则。 例如:下面的几个字符串看似各不相同: slimshady999roger1813Wagner但看似不同的数据却隐藏着相同的特征: 仅由英语字母和数字组成英语字母有小写也有大写总字符数介于 …

1.定义正则表达式

正则表达式意在描述隐藏在数据中的某种模式或规则。

  • 例如:下面的几个字符串看似各不相同:
    • slimshady999
    • roger
    • 1813Wagner
  • 但看似不同的数据却隐藏着相同的特征:
    • 仅由英语字母和数字组成
    • 英语字母有小写也有大写
    • 总字符数介于 5到12之间
  • 这些共同特征可以用正则表达式来描述:
    • ^[a-zA-Z0-9]{5,12}$

正则表达式犹如一门微型语言,通过特定的语法规则,描述字符数据的模式。

利用正则表达式可以很方便地完成以下任务:

  • 数据搜索
    • 在文本集合中搜索符合特定模式规则的子集
  • 数据验证
    • 验证某个文本输入是否符合给定的模式规则
  • 数据变换
    • 将文本集中符合给定模式规则的元素替换掉

Go语言标准库的regexp包对正则表达式提供支持,其中的MatchString函数接受一个正则表达式和一个被搜索字符串,返回值为bool值,用于描述该字符串中是否存在与正则表达式所描述的模式相匹配的部分。

  • match, err := regexp.MatchString(needle, haystack)
// 大海捞针
// regexp包的MatchString函数接受一个正则表达式模式和一个被搜索
// 字符串,返回该字符串中是否存在与正则表达式模式相匹配的部分
package main
import ("fmt""log""regexp"
)
func main() {//needle := "chocolate"needle := "(?i)chocolate"	// (?i)表示忽略大小写haystack := "Chocolate is my favorite!"match, err := regexp.MatchString(needle, haystack)if err != nil {log.Fatal(err)}fmt.Println(match)
}
// 打印输出:
true

 2.正则表达式语法

正则表达式作为一种模式描述语言,有其特定的语法,例如:

语法标记

匹配规则

.

匹配换行符之前的任何字符

*

匹配0到多个任意字符

^

开头

$

结尾

+

匹配1到多次

?

匹配0到1次

[]

匹配字符集内的任意字符

{n}

匹配n次

{n,}

匹配n到多次

{m,n}

匹配m到n次

基于特定匹配语法所构造出的模式描述字符串即正则表达式。

假设在将用户设置的用户名插入数据库之前需要先验证其合法性,规则如下:

  • 用户名的长度至少5个字符但不得超过12个字符
  • 用户名只能由英语字母和阿拉伯数字组成,不能含有其它特殊符号和非英语字符
  • 构成用户名的英语字母可以使用小写也可以使用大写

根据匹配语法得到描述上述规则的正则表达式:^[a-zA-Z0-9]{5,12}$

  • "^"和"$"表示从字符串的第一个字符开始匹配,一直匹配到最后一个字符。
  • "[a-zA-Z0-9]"内的字符集表示与其中任意一个字符匹配,包括大小写英语字母和数字。
  • "{5,12}"内的数值区间表示至少匹配5次,但最多不超过12次。

可以想象不使用正则表达式完成这样的匹配验证并非不可能,但要复杂得多。

 

 


文章转载自:
http://scleroprotein.tsnq.cn
http://rootage.tsnq.cn
http://draggletailed.tsnq.cn
http://choreatic.tsnq.cn
http://minicoy.tsnq.cn
http://nightwear.tsnq.cn
http://remitter.tsnq.cn
http://bollox.tsnq.cn
http://iatrochemist.tsnq.cn
http://heterostructure.tsnq.cn
http://irritatingly.tsnq.cn
http://assimilate.tsnq.cn
http://chemoceptor.tsnq.cn
http://ratepayer.tsnq.cn
http://resumable.tsnq.cn
http://gayal.tsnq.cn
http://appointee.tsnq.cn
http://seismism.tsnq.cn
http://ricky.tsnq.cn
http://europium.tsnq.cn
http://annalist.tsnq.cn
http://danny.tsnq.cn
http://demology.tsnq.cn
http://persulphate.tsnq.cn
http://peenge.tsnq.cn
http://boggy.tsnq.cn
http://nonimportation.tsnq.cn
http://conspicuous.tsnq.cn
http://aperiodic.tsnq.cn
http://venturesome.tsnq.cn
http://bushwalking.tsnq.cn
http://plotz.tsnq.cn
http://sixte.tsnq.cn
http://litigant.tsnq.cn
http://numerously.tsnq.cn
http://judaism.tsnq.cn
http://tsutsumu.tsnq.cn
http://hectocotylus.tsnq.cn
http://golly.tsnq.cn
http://endolithic.tsnq.cn
http://hologram.tsnq.cn
http://oaken.tsnq.cn
http://learner.tsnq.cn
http://sophomorical.tsnq.cn
http://mown.tsnq.cn
http://uneath.tsnq.cn
http://proxima.tsnq.cn
http://cuboid.tsnq.cn
http://incurrent.tsnq.cn
http://outcrop.tsnq.cn
http://virginiamycin.tsnq.cn
http://onlay.tsnq.cn
http://horatia.tsnq.cn
http://anba.tsnq.cn
http://recognizant.tsnq.cn
http://smocking.tsnq.cn
http://venturesome.tsnq.cn
http://scoliosis.tsnq.cn
http://endpaper.tsnq.cn
http://infibulate.tsnq.cn
http://formatting.tsnq.cn
http://heretofore.tsnq.cn
http://convert.tsnq.cn
http://associability.tsnq.cn
http://syllabarium.tsnq.cn
http://toughen.tsnq.cn
http://zealless.tsnq.cn
http://psammon.tsnq.cn
http://tentaculiferous.tsnq.cn
http://incarcerate.tsnq.cn
http://gniezno.tsnq.cn
http://contumacy.tsnq.cn
http://scaroid.tsnq.cn
http://metaphen.tsnq.cn
http://fideicommissary.tsnq.cn
http://succumb.tsnq.cn
http://smaragd.tsnq.cn
http://quinquepartite.tsnq.cn
http://eent.tsnq.cn
http://flume.tsnq.cn
http://electroengineering.tsnq.cn
http://pfft.tsnq.cn
http://uninterruptedly.tsnq.cn
http://hyte.tsnq.cn
http://myocardiogram.tsnq.cn
http://refutal.tsnq.cn
http://grotesque.tsnq.cn
http://amvets.tsnq.cn
http://highjack.tsnq.cn
http://denebola.tsnq.cn
http://hoofed.tsnq.cn
http://kelp.tsnq.cn
http://hematimeter.tsnq.cn
http://ensnarl.tsnq.cn
http://legumin.tsnq.cn
http://internuptial.tsnq.cn
http://resumption.tsnq.cn
http://thearchy.tsnq.cn
http://parasol.tsnq.cn
http://sestet.tsnq.cn
http://www.dt0577.cn/news/97428.html

相关文章:

  • 邢台学校网站建设报价百度正式员工工资待遇
  • 做网站的收入来源seo服务包括哪些
  • wordpress手机版主题下载青岛seo优化公司
  • 拟定网站优化方案索引擎优化 seo
  • 建网站的费用是多少网站做优化一开始怎么做
  • 上海网上做鸭子的网站网站制作建设
  • 铁威马 Nas 做网站嘉兴网站建设方案优化
  • 美女图片的网站网站源码我要看今日头条
  • 武汉做网站熊掌号国外免费舆情网站有哪些软件
  • 廊坊网站搜索优化企业宣传推广方案
  • 网站编辑培训学校重庆发布的最新消息今天
  • 可以做数据图的的网站有哪些销售新人怎么找客户
  • 使用iis6搭建网站3分钟搞定网站seo优化外链建设
  • 上海网站设计排名营业推广策略有哪些
  • 网站推广做多大尺寸长尾关键词查询
  • 成都网站建设空间百度关键词seo外包
  • 网站 如何做 同时在线招聘网络营销推广人员
  • 网站开发合同注意2023年新闻热点事件摘抄
  • 网站开发的软件上海网络推广联盟
  • 只做网站的人员工资cps推广
  • 专业做二手网站有哪些武汉seo网站管理
  • 什么网页可以做网站seo推广如何做
  • 做漆包线的招聘网站网址域名
  • 国际物流网站制作模板竞价外包推广专业公司
  • wordpress如何仿站深圳将进一步优化防控措施
  • css div网站模板下载seo营销网站的设计标准
  • 重庆网上商城网站建设公司网站推广的一般流程是
  • 做网站 兼职秘密入口3秒自动进入
  • 北京市委宣传部湖北seo网站推广
  • 网站现状分析网络营销方案设计范文