当前位置:网站首页>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
边栏推荐
- Does flink cdc support synchronization from oracle dg library?
- IDEA执行Test操作导致数据插入时出现了重复数据
- 欧盟 | 地平线 2020 ENSEMBLE:D2.13 SOTIF Safety Concept(上)
- 七夕浪漫约会不加班,RPA机器人帮你搞定工作
- 科普大佬说 | 港大黄凯斌老师带你解锁黑客帝国与6G的关系
- matcher中find,matches,lookingAt匹配字符串的不同之处说明
- HStreamDB Newsletter 2022-07|分区模型优化、数据集成框架进一步完善
- Concurrent CAS
- 2.4G无线收发模块的应用
- 【zeno】为zeno增加子模块/新节点的最小化的例子
猜你喜欢
dotnet OpenXML parsing PPT charts Getting started with area charts
微服务 技术栈
百行代码发射红心,程序员何愁命不中女朋友!
如何实现按键的短按、长按检测?
19.服务器端会话技术Session
Microservice Technology Stack
【zeno】为zeno增加子模块/新节点的最小化的例子
蚁剑webshell动态加密连接分析与实践
21 Days of Deep Learning - Convolutional Neural Networks (CNN): Weather Recognition (Day 5)
2022.8.3
随机推荐
pytorch余弦退火学习率CosineAnnealingLR的使用
请问大佬们 ,使用 Flink SQL CDC 是不是做不到两个数据库的实时同步啊
express hot-reload
leetcode 剑指 Offer 10- I. 斐波那契数列
XCODE12 在使用模拟器(SIMULATOR)时编译错误的解决方法
明天去订票,准备回家咯~~
交换机端口的三种类型详解与hybrid端口实验
Xcode 12 ld: symbol(s) not found for architecture armv64
Undefined symbols for architecture arm64解决方案
C语言的高级用法
Assembly language (8) x86 inline assembly
Excuse me if you want to write data in mysql, with flink - connector - JDBC directly is ok, but I'm in the f
Two-table query average grouping in sql server
Neuron Newsletter 2022-07|新增非 A11 驱动、即将支持 OPC DA
Weekly Report 2022-8-4
Hbuilder 学习使用中的一些记录
MySQL内部函数介绍
Bias lock/light lock/heavy lock lock is healthier. How is locking and unlocking accomplished?
selectPage 动态改变参数方法
tensorflow.keras cannot introduce layers