当前位置:网站首页>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
边栏推荐
- ECCV 2022 Oral Video Instance Segmentation New SOTA: SeqFormer & IDOL and CVPR 2022 Video Instance Segmentation Competition Champion Scheme...
- 无题十四
- flink cdc支持从oracle dg库同步吗
- 为什么sys_class 里显示的很多表的 RELTABLESPACE 值为 0 ?
- Voice conversion相关语音数据集综合汇总
- ffmpeg drawtext 添加文本水印
- 明天去订票,准备回家咯~~
- Creo 9.0 基准特征:基准点
- 线程之Happens-before规则
- 营销建议 | 您有一份八月营销月历待查收! 建议收藏 !
猜你喜欢
Example of Noise Calculation for Amplifier OPA855
CCVR基于分类器校准缓解异构联邦学习
微服务 技术栈
express hot-reload
Hundred lines of code launch red hearts, why programmers lose their girlfriends!
汇编语言(8)x86内联汇编
shell脚本实例
科普大佬说 | 港大黄凯斌老师带你解锁黑客帝国与6G的关系
Creo 9.0 基准特征:基准坐标系
eKuiper Newsletter 2022-07|v1.6.0:Flow 编排 + 更好用的 SQL,轻松表达业务逻辑
随机推荐
Assembly language (8) x86 inline assembly
七夕浪漫约会不加班,RPA机器人帮你搞定工作
MQTT X Newsletter 2022-07 | 自动更新、MQTT X CLI 支持 MQTT 5.0、新增 conn 命令…
在colab里怎样读取google drive数据
长达四年的减肥记录
Example of Noise Calculation for Amplifier OPA855
21 Days of Deep Learning - Convolutional Neural Networks (CNN): Weather Recognition (Day 5)
21 Days of Deep Learning - Convolutional Neural Networks (CNN): Clothing Image Classification (Day 3)
施一公:科学需要想象,想象来自阅读
欧盟 | 地平线 2020 ENSEMBLE:D2.13 SOTIF Safety Concept(上)
Marketing Suggestions | You have an August marketing calendar to check! Suggest a collection!
Rotation of the displayed value on the button
阿里云存储的数据库是怎么自动加快加载速度的呢www.cxsdkt.cn怎么设置案例?
2022.8.3
Neuron Newsletter 2022-07|新增非 A11 驱动、即将支持 OPC DA
Going to book tickets tomorrow, ready to go home~~
韦东山 数码相框 项目学习(六)tslib的移植
并发之CAS
Science bosses say | Hong Kong rhubarb KaiBin teacher take you unlock the relationship between the matrix and 6 g
蚁剑webshell动态加密连接分析与实践