当前位置:网站首页>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 基准特征:基准平面
- js graphics operation one (compatible with pc, mobile terminal to achieve draggable attribute drag and drop effect)
- 无题十四
- MySQL使用聚合函数可以不搭配GROUP BY分组吗?
- 韦东山 数码相框 项目学习(六)tslib的移植
- C语言的高级用法
- ECCV 2022 Oral 视频实例分割新SOTA:SeqFormer&IDOL及CVPR 2022 视频实例分割竞赛冠军方案...
- sql server中 两表查询 平均数 分组
- 并发之CAS
- 施一公:科学需要想象,想象来自阅读
猜你喜欢
随机推荐
Oracle temporary table space role
XCODE12 在使用模拟器(SIMULATOR)时编译错误的解决方法
The Seven Weapons of Programmers
tensorflow.keras无法引入layers
蚁剑webshell动态加密连接分析与实践
selectPage 动态改变参数方法
leetcode 剑指 Offer 10- II. 青蛙跳台阶问题
shell脚本实例
Happens-before rules for threads
无题十三
21 Days of Deep Learning - Convolutional Neural Networks (CNN): Weather Recognition (Day 5)
自定义过滤器和拦截器实现ThreadLocal线程封闭
Seata source code analysis: initialization process of TM RM client
使用HBuilder离线本地打包ipa教程
交换机端口的三种类型详解与hybrid端口实验
seata源码解析:TM RM 客户端的初始化过程
线程之Happens-before规则
百行代码发射红心,程序员何愁命不中女朋友!
链表中的数字相加----链表专题
matcher中find,matches,lookingAt匹配字符串的不同之处说明









