当前位置:网站首页>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边栏推荐
- There is only one switch, how to realize the nqa of master-slave automatic switching
- CCVR eases heterogeneous federated learning based on classifier calibration
- 茄子科技CEO仇俊:以用户为中心,做用户真正需要的产品
- 2022/8/4 考试总结
- 无题五
- 无题六
- How to realize the short press and long press detection of the button?
- 新白娘子传奇系列
- Is there a problem with writing this?How to synchronize data in sql-client
- shell脚本实例
猜你喜欢
随机推荐
2022-08-01 回顾基础二叉树以及操作
交换机端口的三种类型详解与hybrid端口实验
MySQL使用聚合函数可以不搭配GROUP BY分组吗?
Bias lock/light lock/heavy lock lock is healthier. How is locking and unlocking accomplished?
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
Xcode 12 ld: symbol(s) not found for architecture armv64
Excuse me if you want to write data in mysql, with flink - connector - JDBC directly is ok, but I'm in the f
Hbuilder 学习使用中的一些记录
Creo 9.0 基准特征:基准平面
【LeetCode】623. 在二叉树中增加一行
CCVR基于分类器校准缓解异构联邦学习
my journal link
什么是CRM决策分析管理?
shell脚本实例
【LeetCode】623. Add a row to the binary tree
express hot-reload
无题六
营销建议 | 您有一份八月营销月历待查收! 建议收藏 !
PAT Class B-B1019 Digital Black Hole (20)
Creo 9.0 基准特征:基准坐标系









