[Regex Expression] Confirmative -- World bundry
String to check:

As it turns out, our potential shipmates are extremely superstitious. As such, we do not want anyone to enter certain words in their comments.
Requirements:
1. Let's start checking for bad words within a sentence. We can begin with 'sink'as our first bad word. We will want to make sure this word is by itself and not part of a larger word.
/\bsink\b/gim

2. Looking good, but there are more bad words we need to account for. Let's also check for 'wreck'.
/\b(sink|wreck)\b/gim

3. Almost finished. Our final bad word to match is 'disaster'.
/\b(sink|wreck|disaster)\b/gim

-------------------------------------
/http(s)?:\/\/(www\.)?twitter(\.com|\.org)\/codeschool/gm

[Regex Expression] Confirmative -- World bundry的更多相关文章
- Regex Expression的资料和笔记整理
维基百科:http://en.wikipedia.org/wiki/Regular_expression 正则表达式在线测试:http://tool.chinaz.com/regex/ 正则表达式,常 ...
- [Regex Expression] Find Sets of Characters
Regular Expression Character Classes define a group of characters we can use in conjunction with qua ...
- boost regex expression
Boost.Regex provides three different functions to search for regular expressions 1. regex_match #inc ...
- [Regex Expression] Use Shorthand to Find Common Sets of Characters
In this lesson we'll learn shorthands for common character classes as well as their negated forms. v ...
- URL Regex expression
转载: http://blog.csdn.net/weasleyqi/article/details/7912647 首先,正则表达式: String check = @"((http|ft ...
- [Regex Expression] Tagline --- {0, } {1,10}
Using a character set repeated 1 or more times, make a pattern to search for strings that do not con ...
- [Regex Expression] Match mutli-line number, number range
/^-?\d{,}\.\d+$/gm
- java Suspicious regex expression "." in call to 'replaceAll()' 问题延展
因为要处理从身份证读取到的有效期时间,所以用到了replaceAll这个方法,类似如下代码: String s1 = s.replaceAll(".", "-" ...
- 用Regex类计算一个字符串出现次数是最好方法【转载】
我的一个朋友问我,怎么在c#或vb.net中,计算一个字符串中查找另一个字符串中出现的次数,他说在网上打了好多方法,我看了一下,有的是用replace的方法去实现,这种方法不是太好,占资源太大了.其实 ...
随机推荐
- [Unity3D]蓝港面试题
1. 请简述值类型与引用类型的差别 答: 差别:1.值类型存储在内存栈中,引用类型数据存储在内存堆中,而内存单元中存放的是堆中存放的地址.2.值类型存取快,引用类型存取慢.3.值类型表示实际数据,引用 ...
- swift调用相机和相册
简单实现swift调用相机和相册的功能,分享代码与学习swift的童鞋共同进步 import UIKit class ViewController: UIViewController,UIImageP ...
- QT5 r 加入qwtplot3d 三维库
qwtplot3d是基于QtOpenGL开发的,也是qwt库的三维库,我使用的是qwtplot3d-0.2.7.zip版本. 步骤跟编译qwt库一样(不明白可以看回前面写的一篇文章“Q ...
- 深入解析MySQL replication协议
Why 最开始的时候,go-mysql只是简单的抽象mixer的代码,提供一个基本的mysql driver以及proxy framework,但做到后面,笔者突然觉得,既然研究了这么久mysql c ...
- Power Designer - 反向获取数据库物理模型时Unable to list the users 异常
解决方案: 菜单栏 -> Database -> Change Current DBMS ,给DBMS选择Oracle Version 9i2.
- vs2015升级后台mvc视图编辑器默认不是razor视图引擎问题
1.问题的原因 vs2013中创建的mvc4.0应用默认使用的razor2.0版本 在vs2015编辑器中默认使用的razor视图引擎是3.0版本 解决方案: 第一步:升级mvc应用的版本为mvc5. ...
- SQL 增加或删除一列
SQL 增加或删除一列 alter table tablename drop column columnname;alter table tabelname add columnname varcha ...
- myeclipse添加svn
一直在用MyEclipse,每次重装或者换开发环境时都需要安装svn插件,每次都是在网上找,感觉没有说的太明白的,还是自己写个以备将来查看. 安装svn插件有很多种方式,在线的.离线的.解压的(又分为 ...
- iOS中UISearchBar(搜索框)使用总结
http://my.oschina.net/u/2340880/blog/509756
- 关闭并且禁用ECSHOP缓存
ECSHOP的缓存机制从一定程度上可以减少ECSHOP反复读取数据库的几率,从而一定程度上降低服务器负担,提高访问速度.但是启用缓存机制,对一些新手站长也有不利的地方.我就遇到很多新手站长经常问,我明 ...