当前位置:网站首页>What is the function of the regular expression replaceFirst() method?
What is the function of the regular expression replaceFirst() method?
2022-08-05 09:32:00 【qq_25073223】
From:
The regular expression replaceFirst() methodWhat function does it have?
The following author describes the function introduction of the replaceFirst() method, as follows:
The function of the replaceFirst() method: Use regular replacement to match the first matched string. The syntax of the replaceFirst() method: Pattern pattern = Pattern.compile("regular"); //Generate regular expression Matcher matcher = pattern.matcher("regular 122 regular 88988"); //match character matcher.replaceFirst("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 pattern = Pattern.compile("regular"); //Generate regular expressionMatcher matcher = pattern.matcher("regular 122 regular 88988"); //match charactersSystem.out.println(matcher.replaceFirst("Java")); // replace character}}------Run the above code, the following information will be output-----Java122 regular 88988
边栏推荐
- 开源一夏|OpenHarmony如何查询设备类型(eTS)
- Excuse me, guys, is it impossible to synchronize two databases in real time using Flink SQL CDC?
- PAT Class B-B1019 Digital Black Hole (20)
- 无题七
- 上海控安技术成果入选市经信委《2021年上海市网络安全产业创新攻关成果目录》
- selectPage 动态改变参数方法
- 为什么sys_class 里显示的很多表的 RELTABLESPACE 值为 0 ?
- 无题十三
- (转)[Json]net.sf.json 和org.json 的差别及用法
- 无题二
猜你喜欢
开源一夏|OpenHarmony如何查询设备类型(eTS)
Science bosses say | Hong Kong rhubarb KaiBin teacher take you unlock the relationship between the matrix and 6 g
2022.8.3
【LeetCode】623. Add a row to the binary tree
dotnet OpenXML parsing PPT charts Getting started with area charts
Keil升级到AC6后,到底有哪些变化?
偏向锁/轻量锁/重级锁锁锁更健康,上锁解锁到底是怎么完成实现的
上海控安技术成果入选市经信委《2021年上海市网络安全产业创新攻关成果目录》
15.1.1、md—md的基础语法,快速的写文本备忘录
Marketing Suggestions | You have an August marketing calendar to check! Suggest a collection!
随机推荐
eKuiper Newsletter 2022-07|v1.6.0:Flow 编排 + 更好用的 SQL,轻松表达业务逻辑
放大器OPA855的噪声计算实例
无题十一
科普大佬说 | 港大黄凯斌老师带你解锁黑客帝国与6G的关系
无题二
无题十二
百行代码发射红心,程序员何愁命不中女朋友!
Redis源码解析:Redis Cluster
我的杂记链接
mysql进阶(二十七)数据库索引原理
无题六
Going to book tickets tomorrow, ready to go home~~
欧盟 | 地平线 2020 ENSEMBLE:D2.13 SOTIF Safety Concept(上)
What is CRM Decision Analysis Management?
There is only one switch, how to realize the nqa of master-slave automatic switching
无题十四
Rotation of the displayed value on the button
Concurrent CAS
Tanabata romantic date without overtime, RPA robot helps you get the job done
egg框架使用(二)