当前位置:网站首页>The difference between find, matches, lookingAt matching strings in matcher
The difference between find, matches, lookingAt matching strings in matcher
2022-08-05 09:32:00 【qq_25073223】
From:
find in matcher,matches, lookingAt match string difference description
Introduction to regular expressions:
Regular expression, also known as regular expression, (Regular Expression, often abbreviated as regex, regexp or RE in code), is a text pattern that includes ordinary characters (for example, letters between a to z) andSpecial characters (called "metacharacters") are a concept in computer science.Regular expressions use a single string to describe and match a series of strings that match a syntactic rule, and are usually used to retrieve and replace text that matches a pattern (rule).
Many programming languages support string manipulation using regular expressions.For example, a powerful regular expression engine is built into Perl.The concept of regular expressions was first popularized by tools in Unix (such as sed and grep), and later widely used in Scala, PHP, C#, Java, C++, Objective-c, Perl, Swift, VBScript, Javascript, Ruby, Python, and more.Regular expressions are usually abbreviated as "regex", with regexp, regex in the singular, and regexps, regexes, and regexen in the plural.
Introduction to regular expression related methods:
1. The exec() method is a regular expression method used to retrieve the matching of regular expressions in a string.
The function returns an array in which the matching results are stored; if no match is found, the return value is null.
2. The test() method is a regular expression method used to detect whether a string matches a certain pattern,
Returns true if the string contains matching text, false otherwise.
3. The search() method is used to retrieve the specified substring in the string, or to retrieve the substring matching the regular expression, and return the starting position of the substring.
3.1, the search() method uses regular expressions, uses regular expressions to search for strings, and is case-insensitive
3.2. The search() method uses a string, which can be used as a parameter.String arguments are converted to regular expressions
4. The replace() method is used to replace some characters in a string with other characters, or to replace a substring that matches a regular expression.
4.1. The replace() method uses regular expressions, which use regular expressions and are case-insensitive to replace the parameters in the method with the specified content in the string.
4.2. The replace() method uses a string and will receive a string as a parameter.
5. The match() method retrieves a specified value within a string, or finds a match of one or more regular expressions.
The following describes the difference between find, matches, and lookingAt matching strings in matcher, as follows:
1. Matcher.matches(): Match the entire string, and return true only if the entire string is matched2. Matcher.lookingAt(): start looking from the head of the input, and only return true if the prefix of the string satisfies the pattern3. Matcher.find(): Match the string, the matched string can be in any positionThe difference between the above three: the position of the matched string and whether it is all
边栏推荐
- Creo 9.0 基准特征:基准点
- Overall design and implementation of Kubernetes-based microservice project
- Xcode10的打包方式distribute app和启动项目报错以及Xcode 打包本地ipa包安装到手机上
- Creo 9.0 基准特征:基准坐标系
- PAT Level B - B1021 Single Digit Statistics (15)
- 无题三
- PAT乙级-B1020 月饼(25)
- C语言-数组
- EU | Horizon 2020 ENSEMBLE: D2.13 SOTIF Safety Concept (Part 2)
- mysql进阶(二十七)数据库索引原理
猜你喜欢
Redis源码解析:Redis Cluster
sql server中 两表查询 平均数 分组
如何实现按键的短按、长按检测?
上海控安技术成果入选市经信委《2021年上海市网络安全产业创新攻关成果目录》
CCVR eases heterogeneous federated learning based on classifier calibration
Qiu Jun, CEO of Eggplant Technology: Focus on users and make products that users really need
放大器OPA855的噪声计算实例
Advanced usage of C language
Undefined symbols for architecture arm64解决方案
只有一台交换机,如何实现主从自动切换之nqa
随机推荐
偏向锁/轻量锁/重级锁锁锁更健康,上锁解锁到底是怎么完成实现的
express hot-reload
周报2022-8-4
21 Days of Deep Learning - Convolutional Neural Networks (CNN): Weather Recognition (Day 5)
seata源码解析:TM RM 客户端的初始化过程
js 图形操作一(兼容pc、移动端实现 draggable属性 拖放效果)
ffmpeg drawtext 添加文本水印
Excuse me if you want to write data in mysql, with flink - connector - JDBC directly is ok, but I'm in the f
Which big guy has the 11G GI and ojvm patches in April or January 2020, please help?
Creo 9.0 基准特征:基准轴
无题九
PAT乙级-B1019 数字黑洞(20)
Undefined symbols for architecture arm64解决方案
Microservice Technology Stack
【zeno】为zeno增加子模块/新节点的最小化的例子
欧盟 | 地平线 2020 ENSEMBLE:D2.13 SOTIF Safety Concept(下)
干货!生成模型的评价与诊断
Hbuilder 学习使用中的一些记录
Imitation SBUS fixed with serial data conversion
leetcode points to Offer 10- I. Fibonacci sequence