当前位置:网站首页>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边栏推荐
猜你喜欢

使用 External Secrets Operator 安全管理 Kubernetes Secrets

15.1.1、md—md的基础语法,快速的写文本备忘录

为什么我推荐使用智能化async?

After Keil upgrades to AC6, what changes?

CVPR 2022 | 将X光图片用于垃圾分割,港中大(深圳)探索大规模智能垃圾分类

只有一台交换机,如何实现主从自动切换之nqa

21 Days of Deep Learning - Convolutional Neural Networks (CNN): Weather Recognition (Day 5)

Two-table query average grouping in sql server

【zeno】为zeno增加子模块/新节点的最小化的例子

mysql进阶(二十七)数据库索引原理
随机推荐
Concurrent CAS
手写柯里化 - toString 理解
Weekly Report 2022-8-4
Which big guy has the 11G GI and ojvm patches in April or January 2020, please help?
ffmpeg drawtext add text watermark
Two-table query average grouping in sql server
PAT Class B-B1019 Digital Black Hole (20)
hcip BGP 增强实验
什么是CRM决策分析管理?
周报2022-8-4
Keil升级到AC6后,到底有哪些变化?
无题十三
这样写有问题吗?怎么在sql-client 是可以做到数据的同步的
openpyxl操作Excel文件
PAT乙级-B1021 个位数统计(15)
egg框架使用(二)
tensorflow.keras cannot introduce layers
Oracle临时表空间作用
Xcode10的打包方式distribute app和启动项目报错以及Xcode 打包本地ipa包安装到手机上
随时牵手 不要随意分手[转帖]