当前位置:网站首页>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 character
Example:
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
边栏推荐
- 无题十
- Is there a problem with writing this?How to synchronize data in sql-client
- PAT乙级-B1019 数字黑洞(20)
- MQTT X Newsletter 2022-07 | 自动更新、MQTT X CLI 支持 MQTT 5.0、新增 conn 命令…
- Excuse me, guys, is it impossible to synchronize two databases in real time using Flink SQL CDC?
- 21 Days of Deep Learning - Convolutional Neural Networks (CNN): Weather Recognition (Day 5)
- Overall design and implementation of Kubernetes-based microservice project
- 新白娘子传奇系列
- Thinking and summary of the efficiency of IT R&D/development process specification
- seata源码解析:TM RM 客户端的初始化过程
猜你喜欢
express hot-reload
Advanced usage of C language
ECCV 2022 Oral 视频实例分割新SOTA:SeqFormer&IDOL及CVPR 2022 视频实例分割竞赛冠军方案...
js 图形操作一(兼容pc、移动端实现 draggable属性 拖放效果)
Science bosses say | Hong Kong rhubarb KaiBin teacher take you unlock the relationship between the matrix and 6 g
并发之CAS
Oracle临时表空间作用
百行代码发射红心,程序员何愁命不中女朋友!
上海控安技术成果入选市经信委《2021年上海市网络安全产业创新攻关成果目录》
CVPR 2022 | 将X光图片用于垃圾分割,港中大(深圳)探索大规模智能垃圾分类
随机推荐
无题十二
手写柯里化 - toString 理解
长达四年的减肥记录
pytorch余弦退火学习率CosineAnnealingLR的使用
开源一夏|OpenHarmony如何查询设备类型(eTS)
MQTT X Newsletter 2022-07 | 自动更新、MQTT X CLI 支持 MQTT 5.0、新增 conn 命令…
C语言的高级用法
PAT乙级-B1019 数字黑洞(20)
XCODE12 在使用模拟器(SIMULATOR)时编译错误的解决方法
Science bosses say | Hong Kong rhubarb KaiBin teacher take you unlock the relationship between the matrix and 6 g
偏向锁/轻量锁/重级锁锁锁更健康,上锁解锁到底是怎么完成实现的
(转)[Json]net.sf.json 和org.json 的差别及用法
周报2022-8-4
IDEA执行Test操作导致数据插入时出现了重复数据
5.部署web项目到云服务器
Tanabata romantic date without overtime, RPA robot helps you get the job done
Code Audit - PHP
Assembly language (8) x86 inline assembly
Neuron Newsletter 2022-07|新增非 A11 驱动、即将支持 OPC DA
The Seven Weapons of Programmers