Because of the validity period read from the ID card,所以用到了replaceAll这个方法,类似如下代码:

String s1 = s.replaceAll(".", "-");
但是ideaA warning is displayed above the English period,It is said that a suspected regular expression was found in the method,That is the title of my article in English.
虽然警告,But this spelling can be used normally,如下图:

我就想,Since it can be used normally,Why even warn,That must be a risk,,,经百度发现,,确实有风险,But not this way,而是splitSplit string method,如下图示例:

使用splitFailed to cut string,As a result, the subsequent value cannot be obtained,Baidu says it is actuallysplitWhat method is called by the underlying layer,具体没有研究,有兴趣的小伙伴可以研究研究@我学习一下.

解决方案就是,Don't write risky code,Just wrap it with escape characters,Write as shown below:

这样idea不报警告,method can also be used normally,,This should be the correct spelling,There should be no risk

java Suspicious regex expression "." in call to 'replaceAll()' More related articles on problem extension

  1. 字符串replaceAll()方法报错:java.util.regex.PatternSyntaxException:Unclosed group near index...

    Unclosed group near index错误 A module I wrote before has appeared frequently recently after the project was launchedtomcatcollapsed situation,从logSee the following error message: java.util.regex.Patter ...

  2. java中regex参考

    在Sun的Java JDK 1.40版本中,Java自带了支持正则表达式的包,本文就抛砖引玉地介绍了如何使用java.util.regex包. 可粗略估计一下,除了偶尔用Linux的外,其他Linu ...

  3. java 正则表达式 -Regular Expression

    正则表达式(Regular Expression),It can be said to be a string of characters,It defines a pattern to search for matching strings.正则表达式定义了字符串的模式,可以用来搜索.编辑或处理文本,Not limited to one language(P ...

  4. java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0

    使用repalceAll 方法出现java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0异常 ...

  5. Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 0 [ ^

    Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character clas ...

  6. java.util.regex.PatternSyntaxException: Unexpected internal error near index 1 \ ^

    1 String a = "1991\12\16"; 2 String[] split = a.split("\\"); 3 System.out.printl ...

  7. java.util.regex.Pattern的应用

    java.util.regex.Pattern 正则表达式的一种已编译的实现. 正则表达式通常以字符串的形式出现,It must first be compiled as Pattern类的一个实例.结果模型可以用来生成一个Matcher, ...

  8. Java正则表达式java.util.regex类的简单使用

    1.什么是正则表达式? 正则表达式(regular expression)是根据字符串集合内每个字符串共享的共同特性来描述字符串集合的一种途径.正则表达式可以用于搜索.编辑或者处理文本和数据. Jav ...

  9. 异常 java.util.regex.PatternSyntaxException:

    可变参数是在JDK1.5A row feature that comes out after,It is also a more useful thing remember a lotjfinalThere are many query methods of other frameworks that use variable parameters,I also wrote a method like this myself public class Test{   ...

  10. java.util.regex.PatternSyntaxException: Unclosed character class near index解决办法

    使用str.split("[")时,出现java.util.regex.PatternSyntaxException: Unclosed character class near  ...

随机推荐

  1. Linux下搭建PHP环境

    转载于: http://www.uxtribe.com/php/405.html 该站下有系列PHP文章. 在Linux下搭建PHP环境比Windows下要复杂得多.除了安装Apache,PHP等软件 ...

  2. codeforces Gym 100187J J. Deck Shuffling dfs

    J. Deck Shuffling Time Limit: 2   Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/pro ...

  3. Swift-11-委托模式

    委托是一种设计模式,它允许类或者结构体将一些需要它们负责的功能交由(或委托)给其他的类型的实例.委托模式很简单:定义协议来封装那些需要被委托的函数和方法,使其遵循者拥有这些被委托的函数和方法.委托模式 ...

  4. js之基本包装类型

    为了便于操作“基本类型值”,JS 提供了 三个 特殊的引用类型:Boolean.Number.String.这些类型和其他引用类型相似,但同时 也具备 与各自基本类型相应的特殊行为. 实际上:每当读取 ...

  5. Extjs combobox设置默认值

    转载:http://www.54mask.com/extjs-combobox-default-value.html 相信很多人都遇到了在ExtJS框架中设置combo组件默认值的需求,ExtJS框架 ...

  6. 汇编指令-MOV与ldr区别(7)

    MOV 1.可以寄存器与寄存器之间传递数据 2.Constants can be passed into registers(常数不能超过32位) LDR 1.可以地址与寄存器之间的数据传递 2.也Constants can be passed into registers 实例: 1.r1与r2pass between ...

  7. 【转】sqlserver使用sql导出索引

    转自:http://blog.itpub.net/16436858/viewspace-609341/ BEGIN WITH tx AS ( SELECT a.object_id ,b.name AS ...

  8. three.js学习:性能监视器stats.js的用法

    用法一: var stats = new Stats(); stats.setMode(0); stats.domElement.style.position = 'absolute'; stats. ...

  9. POJ 1273 - Drainage Ditches - [最大流模板题] - [EK算法模板][Dinic算法模板 - 邻接表型]

    题目链接:http://poj.org/problem?id=1273 Time Limit: 1000MS Memory Limit: 10000K Description Every time i ...

  10. [Todo] Java并发编程学习

    There are two series of blog posts,You can look at it alternately: 1. Java并发编程与技术内幕 http://blog.csdn.net/Evankaka/article/details/51866242 2. [Java并发 ...