国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > PowerShell > 正文

PowerShell常用正則表達(dá)式和語法參考

2020-10-29 21:08:35
字體:
供稿:網(wǎng)友

本文介紹PowerShell中的正則表達(dá)式,各種不同的字符代表不同的含義,包括占位符PlaceHolder、量詞Quantifier和邊界字符。

下面列舉PowerShell的正則表達(dá)式中可能出現(xiàn)的字符,以及它們表示的含義。

字符串的匹配符(占位符PlaceHolder)

. 這是一個點兒,表示換行符之外的任意一個字符(Any character except newline (Equivalent: [^/n]))
[^abc] 指定的字符(abc)之外的任意一個字符,可以把abc換成其它字符組。(All characters except the ones specified)
[^a-z] 任意一個非小寫字母的字符(All characters except those in the region specified)
[abc] 指定的字符集中的任意一個,即abc中的任意一個(One of the characters)
[a-z] 指定的字符范圍中的任意一個,即任意一個小寫字母。One of the characters in the region
/a 響呤(Bell (ASCII 7))
/c Any character allowed in XML names
/cA-/cZ Control+A to Control+Z, ASCII 1 to ASCII 26
/d 任意一個數(shù)字,等同于[0-9](Any number (Equivalent: [0-9]))
/D 任意一個非數(shù)字。Any non-number
/e ESC鍵(Escape (ASCII 27))
/f Form Feed, (ASCII 12)
/n 換行Line break
/r 回車Carriage return
/s 任意一個空白鍵(空白鍵如tab,換行)Any whitespace (space, tab, new line)
/S 任意一個非空白字符(Any non-whitespace)
/t tab鍵
/w 字母,數(shù)字和下劃線(Letter, number or underline)
/W /w的補集(Non-letter, number, or underline)

匹配次數(shù)(量詞Quantifier)

* 出現(xiàn)零次、1次、多次(Any (no occurrence, once, many times))
? 出現(xiàn)零次、1次(No occurrence or one occurrence)
{n,} 出現(xiàn)至少n次(At least n occurrences)
{n,m} 出現(xiàn)至少n次,最多m次(At least n occurrences, maximum m occurrences)
{n} 出現(xiàn)n次(Exactly n occurrences)
+ 出現(xiàn)1次、多次(One or many occurrences)

所有的匹配次數(shù)的符號,默認(rèn)情況下都是貪婪的,即它將最大長度的進行匹配。如果想要得到最短的匹配,那就要在上面這組符號之后加一個問號(?)。

匹配邊界

$ 字符串結(jié)束(End of text)
^ 字符串開始(Start of text)
/b Word boundary
/B No word boundary
/G After last match (no overlaps)

關(guān)于PowerShell正則表達(dá)式參考,本文就介紹這么多,希望對您有所幫助,謝謝!

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 锦州市| 东丰县| 中宁县| 谢通门县| 平乡县| 华容县| 商洛市| 广元市| 松江区| 道孚县| 平泉县| 仲巴县| 深圳市| 鄂托克前旗| 高碑店市| 灵武市| 乌鲁木齐县| 同德县| 马龙县| 鸡泽县| 上饶县| 博客| 临泉县| 泰顺县| 和田县| 沙坪坝区| 开封县| 新安县| 西畴县| 郁南县| 安义县| 四子王旗| 东光县| 万年县| 霍城县| 胶州市| 惠安县| 通山县| 上饶县| 岳普湖县| 民丰县|