- JavaScript:Moving to ES2015
- Ved Antani Simon Timms Narayan Prusty
- 101字
- 2021-07-09 19:07:34
Beginning and end
Frequently, we may wish to ensure that a pattern matches at the beginning of a string or perhaps at the end of a string. The caret character, when used as the first character of the RegEx, anchors the match at the beginning of the string such that /^test/
matches only if the test substring appears at the beginning of the string being matched. Similarly, the dollar sign ($
) signifies that the pattern must appear at the end of the string: /test$/
.
Using both ^
and $
indicates that the specified pattern must encompass the entire candidate string: /^test$/
.
推薦閱讀
- Vue.js入門與商城開發(fā)實(shí)戰(zhàn)
- R語言游戲數(shù)據(jù)分析與挖掘
- Instant 960 Grid System
- Visual C++串口通信技術(shù)詳解(第2版)
- Visual Basic程序設(shè)計教程
- Mastering Scientific Computing with R
- Mastering Kali Linux for Web Penetration Testing
- JavaScript+Vue+React全程實(shí)例
- Big Data Analytics
- Hands-On Enterprise Automation with Python.
- Python機(jī)器學(xué)習(xí)算法與實(shí)戰(zhàn)
- Highcharts Cookbook
- Learning Continuous Integration with TeamCity
- Learning Apache Cassandra
- 微信小程序開發(fā)實(shí)戰(zhàn):設(shè)計·運(yùn)營·變現(xiàn)(圖解案例版)