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. 利用JS实现简单的瀑布流效果

    哈哈, 我又来啦, 在这一段时间里, 我简单的学习了一下javascript(JS), 虽然不是很懂啦, 但是我也简单的尝试着做了点小东西, 就比如现在流行的瀑布流效果, 经过我的努力终于成功的完成了 ...

  2. JS高级程序设计学习笔记之Date类型

    日期对象的创建:var now =new Date(),不传递参数时,对象自动获取当前时间.(若要创建特定日期与时间的对象,必须传入该日期距离1970/1/1零点的毫秒数). Date.parse() ...

  3. 传感器仿真平台——UI绘制模块(二)

    这一章讲的是UI绘制模块 该模块的作用是将实验对象绘制出来,它可能是目标.传感器等等,由于事先并不知道会有哪些物体,也无法事先定义好某个对象该怎么画,以我懒人的性格,得了,就抛给用的人吧~喝前摇一摇, ...

  4. Asp.Net HttpApplication请求管道与Session(二)

    Asp.Net 回话的创建与结束 LogHelper.LogHelper _log = new LogHelper.LogHelper(); /// <summary> /// 程序开始- ...

  5. 17 java 存在的问题(转)

    java的问题: 1.性能:java的内存管理似乎比较自动化,但其实性能不是特别好.尤其是new对象的时候没有节制.在java中,有些对象构造成本很低,有些 很高.特别在UI编程的时候,大多数的UI对 ...

  6. [译]终极塔防——运用HTML5从头创建一个塔防游戏

    翻译共享一篇CodeProject的高星力作,原文地址:http://www.codeproject.com/Articles/737238/Ultimate-Tower-Defense 下载演示项目 ...

  7. 一个商品练习的py

    #!/usr/bin/env python # coding=utf-8 # by 星空刺 qian = int(raw_input("请输入当前money:")) gongzi ...

  8. android 导航布局

    http://blog.csdn.net/wangjinyu501/article/details/8140588 http://www.cnblogs.com/hanyonglu/archive/2 ...

  9. DJANGO的HTTPRESPONSE流式输出

    在项目当中遇到的问题,网上有样例代码,但都不行,后来,发现在了1.5版本之后,新的STREAMHTTPRESPONSE对象, 搞定. from django.http import HttpRespo ...

  10. LeetCode_Path Sum II

    Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...