首页 > 其他分享 >regex cheat sheet

regex cheat sheet

时间:2023-02-09 00:44:04浏览次数:60  
标签:regex sheet string cheat character https foo Lookbehind

regex pattern visualizer : regex101: build, test, and debug regex https://regex101.com/

regex

regex character

character meaning
\d digital characters
\D not digital characters
\w Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to [A-Za-z0-9_].
\W Matches any character that is not a word character from the basic Latin alphabet. Equivalent to [^A-Za-z0-9_].
\s Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to [\f\n\r\t\v\u0020\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]. For example, /\s\w*/ matches " bar" in "foo bar".
\b word boundary. "\baa\b.*" matches "aa bb", dose not match "aabb".

look ahead and look behind

Lookaround Name What it Does
(?=foo) Lookahead Asserts that what immediately follows the current position in the string is foo
(?<=foo) Lookbehind Asserts that what immediately precedes the current position in the string is foo
(?!foo) Negative Lookahead Asserts that what immediately follows the current position in the string is not foo
(?<!foo) Negative Lookbehind Asserts that what immediately precedes the current position in the string is not foo

lazy vs greedy

type pattern description
greedy .* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
lazy .*? matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy)

ref

Lookahead and Lookbehind Tutorial—Tips &Tricks
https://www.rexegg.com/regex-lookarounds.html

Regex Tutorial - Lookahead and Lookbehind Zero-Length Assertions
https://www.regular-expressions.info/lookaround.html

Regular expressions - JavaScript | MDN
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions

Character classes - JavaScript | MDN
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes

标签:regex,sheet,string,cheat,character,https,foo,Lookbehind
From: https://www.cnblogs.com/yusisc/p/17100258.html

相关文章

  • [cheatsheet]
    [cheatsheet]pwncli_templatemaybeucanusepwnclitemplateinshell~LOL#!/bin/shecho-n"#!/usr/bin/envpython3'''Author:7resp4ssDate:">exp.pyttime=......
  • 工作中常用的Excel sheet表操作,你一定会遇到
    工作中遇到的例子,做个记录。在Excel中使用VBA方法:打开Excel,按住ALT+F11,调出VBA窗口。批量去除Excel所有sheet表中筛选SubRemoveAllAutoFilter()DimshtAsWorksheetFo......
  • 由Java正则表达式的灾难性回溯引发的高CPU异常:java.util.regex.Pattern$Loop.match
    问题与分析某天领导report了一个问题:线上的CPU自从上一个版本迭代后就一直处于居高不下的状况,领导看着这段时间的曲线图判断是有两条线程在不停的死循环。接到任务后去查看......
  • 【Regex】判断密码强度的正则表达式
    原文地址https://www.cnblogs.com/younShieh/p/17082522.html❤如果本文对你有所帮助,不妨点个关注和推荐呀,这是对笔者最大的支持~❤ 需求  最近在最做一个软件的注......
  • Difference between wildcard pattern and regex?
    Differencebetweenwildcardpatternandregex?Wildcardpatternsandregularexpressions(regex)arebothusedtomatchpatternsintext,buttheyhavesome......
  • 若依 excel 导出多个sheet
    同事操作excel用了若依的工具类 但是这个工具类里面一个工作簿里面只能有一个sheet 不好用稍微改了一下,加几个方法变成支持多个sheet的 主要就是里面有个sheet成......
  • luckysheet踩坑记录
    这几天接手一个luckysheet的项目,新需求+填坑总共花了一周,整理下踩的坑。一,数字变为科学计数这个真的是要给开发团队特别狠的法克鱿,已经设置文本的单元格(sheet和excel......
  • LCD学习(韦东山)二 datesheet
    1.1硬件原理IMX6ULL的LCD控制器名称为eLCDIF(EnhancedLCDInterface,增强型LCD接口),主要特性如下:支持MPU模式:有些显示屏自带显存,只需要把命令、数据发送给显示屏即可;80......
  • luckysheet导出excel表格(使用exceljs,支持图片)
    一.技术exceljs;luckysheet参考文档:使用exceljs导出luckysheet表格_csdn_lsy的博客-CSDN博客_luckysheet导出;            https://github.c......
  • 正则表达式快速入门三: python re module + regex 匹配示例
    使用Python实现不同的正则匹配(从literalcharacter到其他常见用例)referencepythonregularexpressiontutorial目录importingreliteralcharacters(basic/ord......