#!/bin/bash

variable="This is a fine mess."

echo "$variable"

# Regex matching with =~ operator within [[ double brackets ]].
if [[ "$variable" =~ T.........fin*es* ]]
# NOTE: 从bash V3.2开始,正则表达式不再用引号引起来
then
echo "match found"
# match found
fi
#!/bin/bash

input=$

if [[ "$input" =~ "[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]" ]]
# ^ NOTE: Quoting not necessary, as of version 3.2 of Bash.
# NNN-NN-NNNN (where each N is a digit).
then
echo "Social Security number."
# Process SSN.
else
echo "Not a Social Security number!"
# Or, ask for corrected input.
fi

最新文章

  1. FreeMarker:怎么使用
  2. [Python] 网络爬虫和正则表达式学习总结
  3. 保利威视Polyv点播集成
  4. Controlling z-order using the ZIndex Property
  5. 手绘经典QQ头像 请让我一个人呆一会
  6. python小记列表排序
  7. 仿中关村win8频道(win8.zol.com.cn)下的tab效果
  8. .net后台获取DataTable数据,转换成json数组后传递到前台,通过jquery去操作json数据
  9. ansj人名识别
  10. 第26月第18天 mybatis_spring_mvc
  11. VC++ 字符串Dword、LPSTR、LPWSTR、LPCSTR、LPCWSTR、LPTSTR、LPCTSTR
  12. dell 远程管理卡的使用racadm
  13. Fabric密码保存
  14. sourcetree向github推送代码提示密码错误
  15. CentOS7.3下的一个iptables配置
  16. docker centos:latest 使用 sshd
  17. 客户端和服务端如何使用Token和Session
  18. webpack Error: Cannot find module 'webpack/lib/Chunk' Extract-text-webpack-plugin 分离CSS
  19. jquery hide和show方法
  20. 【深入理解JAVA虚拟机】第5部分.高效并发.1.Java内存模型与线程。

热门文章

  1. Scala学习十六——XML处理
  2. CF336C-Vasily the Bear and Sequence题解--贪心
  3. python matplotlib 折线图
  4. C#/.net 通过js调用系统相机进行拍照,图片无损压缩后进行二维码识别
  5. PropertiesUtils(普遍做法)
  6. 2.4 使用 xpath 对xml 进行解析
  7. 工作总结 页面 ActionResult / JsonResult 将对象以 Json() 返回
  8. C++中volatile
  9. 制作docker 离线仓库
  10. 02 js原型链