在shell腳本中,我們有\ t用於製表符,\ s用於空格,\ w用於單詞。 什麼是\W (capital W) and \D (capital D)
用於? W D在shell腳本中代表什麼?
2
A
回答
5
\W
與\w
相反,\D
與\d
相反。
這就像\S
是\s
的相反。
\W
和\D
將分別匹配\w
和\d
分別不匹配。
您可以查看this site瞭解更多解釋。
\w
通常匹配[A-Za-z0-9_]
(忽略外國字符)
\W
從而匹配[^A-Za-z0-9_]
而且,由於
\d
通常匹配[0-9]
(忽略外國位數)
\D
從而匹配[^0-9]
6
按照manual:
\W Match a non-word character
\D Match a non-digit character
\W
不是由\w
匹配任何字符匹配。同樣\D
與任何不匹配\d
的字符匹配。
相關問題
- 1. $是什麼?和$#代表Shell腳本?
- 2. 在java -D中D代表什麼?
- 3. 什麼呢在shell腳本
- 4. 什麼shell腳本做-d命令和命令解壓
- 5. 在shell腳本中,。[!。] *是什麼意思?
- 6. Shell腳本:shell腳本中的-z是什麼意思?
- 7. bash腳本代表什麼?
- 8. 什麼-d值在shell中的if表達式中?
- 9. 什麼是此行的shell腳本做
- 10. 爲什麼rev com腳本在shell腳本中不工作
- 11. gl_FragCoord中1/w座標代表什麼?
- 12. 什麼是$?shell腳本中的WORK?
- 13. shell腳本中的##是什麼意思
- 14. 什麼是shell腳本中的DEFINE
- 15. shell腳本中`$ [``的用途是什麼?
- 16. 什麼是shell腳本中的$ APPHOME?
- 17. 是什麼〜在Linux shell腳本$
- 18. 什麼是在這個shell腳本
- 19. Shell - 這個腳本在做什麼?
- 20. 是什麼意思〜在unix Shell腳本
- 21. 爲什麼不在shell腳本中使用SQLLDR創建表?
- 22. 在shell腳本表達式中,「plus colon」(「+:」)是什麼意思?
- 23. 在shell腳本中,表達式`$ {ID: - }`是做什麼的?
- 24. shell腳本問題「if [-d $ {directory}]」
- 25. 是什麼$?在shell腳本中意味着什麼?
- 26. 什麼shell不代表
- 27. 爲什麼sed在shell腳本中的行爲不同?
- 28. 「-z」在shell腳本中究竟做了什麼?
- 29. 在bash中,爲什麼變量在shell中可見,但不在shell腳本中
- 30. 這個表達式評估什麼? (bash shell腳本)
此答案已添加到「字符類」下的[Stack Overflow Regular Expression FAQ](http://stackoverflow.com/a/22944075/2736496)中。 – aliteralmind