当前位置:网站首页>What is the function of the regular expression replaceAll() method?
What is the function of the regular expression replaceAll() method?
2022-08-05 09:32:00 【qq_25073223】
From:
The regular expression replaceAll() methodWhat function does it have?
The following author describes the function introduction of the replaceAll() method, as follows:
The function of the replaceAll() method: Use regular replacement to replace all the matched strings Syntax of the replaceAll() method: Pattern pattern = Pattern.compile("Regular"); //Generate regular expression Matcher matcher = pattern.matcher("regular 122 regular 88988"); //match character matcher.replaceAll("Java")); //replace characterExample:
package com.java265.other;import java.util.regex.Matcher;import java.util.regex.Pattern;public class testClass {/** Use of java265.com Pattern class*/public static void main(String[] args) {Pattern p = Pattern.compile("([a-z]+)");Matcher m1 = p.matcher("java265.com888888");Matcher m2 = p.matcher("java67");System.out.println(m1.replaceAll("Niu Niu"));System.out.println(m1.replaceAll("Niu Niu"));}}-----Run the above code, the following information will be output----Niuniu 265. Niuniu 888888Niu Niu 265. Niu Niu 888888边栏推荐
猜你喜欢

什么是CRM决策分析管理?

Bias lock/light lock/heavy lock lock is healthier. How is locking and unlocking accomplished?

使用 External Secrets Operator 安全管理 Kubernetes Secrets

【Excel实战】--图表联动demo_001

CCVR eases heterogeneous federated learning based on classifier calibration

Thinking and summary of the efficiency of IT R&D/development process specification

Weekly Report 2022-8-4

seata源码解析:事务状态及全局锁的存储

eKuiper Newsletter 2022-07|v1.6.0:Flow 编排 + 更好用的 SQL,轻松表达业务逻辑

Marketing Suggestions | You have an August marketing calendar to check! Suggest a collection!
随机推荐
科普大佬说 | 港大黄凯斌老师带你解锁黑客帝国与6G的关系
Xcode10的打包方式distribute app和启动项目报错以及Xcode 打包本地ipa包安装到手机上
只有一台交换机,如何实现主从自动切换之nqa
The technological achievements of Shanghai Konan were selected into the "2021 Shanghai Network Security Industry Innovation Research Achievement Catalog" by the Municipal Commission of Economy and Inf
Example of Noise Calculation for Amplifier OPA855
C语言的高级用法
开源一夏|OpenHarmony如何查询设备类型(eTS)
There is only one switch, how to realize the nqa of master-slave automatic switching
2022.8.3
EU | Horizon 2020 ENSEMBLE: D2.13 SOTIF Safety Concept (Part 2)
深度学习21天——卷积神经网络(CNN):天气识别(第5天)
干货!生成模型的评价与诊断
为什么我推荐使用智能化async?
leetcode 剑指 Offer 10- I. 斐波那契数列
The Seven Weapons of Programmers
【LeetCode】623. 在二叉树中增加一行
openpyxl to manipulate Excel files
Assembly language (8) x86 inline assembly
百行代码发射红心,程序员何愁命不中女朋友!
IO流篇 -- 基于io流实现文件夹拷贝(拷贝子文件夹及子文件夹内文件)满满的干货