1.匹配hi开头的单词,只需要匹配一次。s='hi ,his name is history!'
2.匹配hi开头的单词,需要匹配二次。s='hi ,his name is history!'
3.匹配hi开头的单词,需要返回全部匹配结果。s='hi ,his name is history!'
4.匹配以ing或者noon为结尾的单词。s='good morning,good afternoon,good evening'
5.匹配包含tom的内容(忽略大小写)并返回匹配的个数。s='My name is Tom, and
you can call me Tommy too'。
6.匹配以in开头单词的后半部分(如integrated-->返回tegrated)。
s='introduction,i am interesting boy'
7.匹配不包含连续字符串abc的单词。s='abcddd qweabee ddabc abc cba'
8.匹配网址格式,如www.baidu.com或者https://www.baidu.com/
9.匹配指定格式的电话号码,如010-1234-5678或者1234-5678
10.随机生成10位数字,如果10位数字中有任意3位连续数字,返回666,否则返回0
实现
给定字符串s="i Am a gOod boy baby!!"
1、判断一个字符串中字母是否全部为小写
2、判断有多少个空格
3、求大写字母的个数
4、匹配小写字母开头的单词,计算数量
5、查找所有单词
6、匹配以b开头的单词
7、匹配
s='123@qq.comaaa@163.combbb@126.comasdfasfs33333@adfcom'中的邮箱
8、匹配浮点数,如“8.256”
9、匹配时间格式“xx年-xx月-xx日”
10、匹配s="f2sf f3sf r4re pp34f p2op" 匹配出单词,并且匹配出第二位为2的单词