当前位置:网站首页>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 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 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边栏推荐
猜你喜欢

营销建议 | 您有一份八月营销月历待查收! 建议收藏 !

pytorch余弦退火学习率CosineAnnealingLR的使用

Undefined symbols for architecture arm64解决方案

Oracle临时表空间作用

自定义过滤器和拦截器实现ThreadLocal线程封闭

欧盟 | 地平线 2020 ENSEMBLE:D2.13 SOTIF Safety Concept(上)

哪位大佬有20年4月或者1月的11G GI和ojvm补丁呀,帮忙发下?

手把手教你纯c实现异常捕获try-catch组件

Tanabata romantic date without overtime, RPA robot helps you get the job done

CVPR 2022 | 将X光图片用于垃圾分割,港中大(深圳)探索大规模智能垃圾分类
随机推荐
Happens-before rules for threads
无题十一
使用稀疏 4D 卷积对 3D LiDAR 数据中的运动对象进行后退分割(IROS 2022)
2022.8.3
hcip BGP 增强实验
Two-table query average grouping in sql server
无题一
自定义过滤器和拦截器实现ThreadLocal线程封闭
什么是CRM决策分析管理?
PAT Grade B-B1020 Mooncake(25)
如何实现按键的短按、长按检测?
上海控安技术成果入选市经信委《2021年上海市网络安全产业创新攻关成果目录》
Concurrent CAS
只有一台交换机,如何实现主从自动切换之nqa
Marketing Suggestions | You have an August marketing calendar to check! Suggest a collection!
科普大佬说 | 港大黄凯斌老师带你解锁黑客帝国与6G的关系
使用 External Secrets Operator 安全管理 Kubernetes Secrets
leetcode refers to Offer 10- II. Frog jumping steps
dotnet OpenXML 解析 PPT 图表 面积图入门
为什么我推荐使用智能化async?