当前位置:网站首页>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
边栏推荐
猜你喜欢
科普大佬说 | 港大黄凯斌老师带你解锁黑客帝国与6G的关系
使用HBuilder离线本地打包ipa教程
Seata source code analysis: initialization process of TM RM client
轩辕实验室丨欧盟EVITA项目预研 第一章(四)
放大器OPA855的噪声计算实例
seata源码解析:TM RM 客户端的初始化过程
Overall design and implementation of Kubernetes-based microservice project
深度学习21天——卷积神经网络(CNN):天气识别(第5天)
Marketing Suggestions | You have an August marketing calendar to check! Suggest a collection!
ECCV 2022 Oral Video Instance Segmentation New SOTA: SeqFormer & IDOL and CVPR 2022 Video Instance Segmentation Competition Champion Scheme...
随机推荐
PAT Grade B-B1020 Mooncake(25)
线程之Happens-before规则
tensorflow.keras cannot introduce layers
微服务 技术栈
Concurrent CAS
无题十三
请问大佬们 ,使用 Flink SQL CDC 是不是做不到两个数据库的实时同步啊
无题八
在colab里怎样读取google drive数据
使用 External Secrets Operator 安全管理 Kubernetes Secrets
ffmpeg drawtext 添加文本水印
这样写有问题吗?怎么在sql-client 是可以做到数据的同步的
欧盟 | 地平线 2020 ENSEMBLE:D2.13 SOTIF Safety Concept(下)
Imitation SBUS fixed with serial data conversion
(转)[Json]net.sf.json 和org.json 的差别及用法
MQTT X Newsletter 2022-07 | 自动更新、MQTT X CLI 支持 MQTT 5.0、新增 conn 命令…
C语言的高级用法
Bias lock/light lock/heavy lock lock is healthier. How is locking and unlocking accomplished?
Is there a problem with writing this?How to synchronize data in sql-client
PAT乙级-B1020 月饼(25)