正则匹配中 ^ $ 和 \b 的区别

 
 
^和$分别代表字符串的开始和结束,因此^\d$只能匹配包含一个数字的字符串
\b代表单词边界,其前后必须是不同类型的字符,可以组成单词的字符为一种类型,不可组成单词的字符(包括字符串的开始和结束)为另一种类型
因此\b\d\b可以匹配"%3%"中的3,但不能匹配"23"中的任意一个数字

随机推荐

  1. Unable to execute dex: GC overhead limit exceeded

    Android打包时下面的错误: Unable to execute dex: GC overhead limit exceeded GC overhead limit exceeded 解决的方法: ...

  2. Highcharts使用教程(1):制作简单图表

    今天我们要使用JavaScript图表Highcharts制作简单的柱形图,我们已经安装好Highcharts,让我们开始制作图表吧. 步骤一 在网页中添加一个div.设置id,设置图表长.高.代码如 ...

  3. Configure Visual Studio 2013 for debugging .NET framework

    https://referencesource.microsoft.com/ In order to configure Visual Studio 2013 do the following in ...

  4. ClientScript.RegisterStartupScript 不起作用

    asp.net webform 使用 ClientScript.RegisterStartupScript 不起作用 form 加上 runat="server",ok

  5. “You couldn’t see my tears cause I am in the water.“ Fish said to water.“But I could feel your tears cause you are in my heart..“ Answered water.

    “You couldn’t see my tears cause I am in the water.“ Fish said to water.“But I could feel your tears ...

  6. win7 ins 30131 oracle 12c

    Cause - Failed to access the temporary location. Action - Ensure that the current user has required ...

  7. WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常

    WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常 在wpf中封装Com组件时,调用组件 ...

  8. 轻松实现Android,iOS的一个手势动画效果

    先来看效果 这是iOS下的效果,android下完全一致.通过do_GestureView组件和do_Animation组件,deviceone能很容易实现复杂的跨平台纯原生动画效果,这个示例就是通过 ...

  9. App瘦身

    http://www.zoomfeng.com/blog/ipa-size-thin.html https://github.com/ming1016/SMCheckProject

  10. Codeforces 722D. Generating Sets

    D. Generating Sets time limit per test 2 seconds memory limit per test 256 megabytes input standard ...