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的更多相关文章

  1. Regex Expression的资料和笔记整理

    维基百科:http://en.wikipedia.org/wiki/Regular_expression 正则表达式在线测试:http://tool.chinaz.com/regex/ 正则表达式,常 ...

  2. [Regex Expression] Find Sets of Characters

    Regular Expression Character Classes define a group of characters we can use in conjunction with qua ...

  3. boost regex expression

    Boost.Regex provides three different functions to search for regular expressions 1. regex_match #inc ...

  4. [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 ...

  5. URL Regex expression

    转载: http://blog.csdn.net/weasleyqi/article/details/7912647 首先,正则表达式: String check = @"((http|ft ...

  6. [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 ...

  7. [Regex Expression] Match mutli-line number, number range

    /^-?\d{,}\.\d+$/gm

  8. java Suspicious regex expression "." in call to 'replaceAll()' 问题延展

    因为要处理从身份证读取到的有效期时间,所以用到了replaceAll这个方法,类似如下代码: String s1 = s.replaceAll(".", "-" ...

  9. 用Regex类计算一个字符串出现次数是最好方法【转载】

    我的一个朋友问我,怎么在c#或vb.net中,计算一个字符串中查找另一个字符串中出现的次数,他说在网上打了好多方法,我看了一下,有的是用replace的方法去实现,这种方法不是太好,占资源太大了.其实 ...

随机推荐

  1. Oracle—RMAN备份(一)

    一.RMAN备份相关概念 1.RMAN备份中表空间不需要处于backup模式下,它备份数据文件,归档日志文件,控制文件,spfile和备份集片,但不备份联机重做日志文件,临时文件和口令文件. 2.备份 ...

  2. setTimeout()和setInterval()小结

    写在前面:在写H5游戏时经常需要使用定时刷新页面实现动画效果,比较常用即setTimeout()以及setInterval() setTimeout 描述 setTimeout(code,millis ...

  3. HTML与CSS入门——第十四章  使用边距、填充、对齐和浮动

    知识点: 1.在元素周围添加边距的方法 2.在元素中添加填充的方法 3.对齐的方法 4.float属性的使用 这里提到了CSS禅意花园,这块有时间可以玩玩~ margin和padding:用于添加元素 ...

  4. Invalid content was found starting with element 'taglib'”

    今天在使用struts-menu制作菜单,在web.xml中写入 <taglib>      <taglib-uri>/WEB-INF/struts-menu.tld</ ...

  5. hdu Phone List

    Problem Description Given a list of phone numbers, determine if it is consistent in the sense that n ...

  6. Combination Sum,Combination Sum II,Combination Sum III

    39. Combination Sum Given a set of candidate numbers (C) and a target number (T), find all unique co ...

  7. Python代码一定要对齐

    不然会出现错误: IndentationError: unindent does not match any outer indentation level PS:新的Python语法,是不支持的代码 ...

  8. wind7下搭建ftp服务器

    一.首先在本地机器上创建一个用户!这些用户是用来登录到FTP的!我的电脑右键->控制面板->管理工具->计算机管理->本地用户和组->用户->“右键”新建用户-&g ...

  9. 使用MSSM管理工具登录LOCALDB

    调试程序没有安装 sql server时,可以使用localdb.这是一个简易的sql server数据库,用于本地测试是很方便,省去安装SQL SERVER的工作 电脑上安装了VS2013 VS20 ...

  10. Modified Kaprekar Numbers

    Link: https://www.hackerrank.com/challenges/kaprekar-numbers from __future__ import print_function d ...