第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

正則表達(dá)式無法創(chuàng)建,錯(cuò)誤表現(xiàn)如下:請(qǐng)問我該怎么修改?

正則表達(dá)式無法創(chuàng)建,錯(cuò)誤表現(xiàn)如下:請(qǐng)問我該怎么修改?

波斯汪 2022-05-08 04:00:57
^/[((/d{11})|((/d{3})-(/d{8})))(^1/])$正則表達(dá)式無法創(chuàng)建錯(cuò)誤:Illegal character range near index 22 ^/[((/d{11})|((/d{3})-(/d{8})))(^1/])$ ^
查看完整描述

2 回答

?
元芳怎么了

TA貢獻(xiàn)1798條經(jīng)驗(yàn) 獲得超7個(gè)贊

在Java中,你必須對(duì)每一個(gè)向前的斜杠(“\”)進(jìn)行轉(zhuǎn)義處理。圖十不是Java的表示形式,所以我們要在每個(gè)“\”前面加上一個(gè)“\”以免出現(xiàn)編譯錯(cuò)誤。遺憾的是,轉(zhuǎn)義處理過程很容易出現(xiàn)錯(cuò)誤,所以應(yīng)該小心謹(jǐn)慎。你可以首先輸入未經(jīng)轉(zhuǎn)義處理的正則表達(dá)式,然后從左到右依次把每一個(gè)“\”替換成“\\”
import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.MatchResult;
import org.apache.oro.text.regex.Pattern;
import org.apache.oro.text.regex.PatternCompiler;
import org.apache.oro.text.regex.PatternMatcher;
import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;

public class Zhengze {

public static void main(String[] args) throws MalformedPatternException {
PatternCompiler compiler = new Perl5Compiler();
String str = ",,test,,,,test";
String argexp = ".*,{3}.*";
Pattern pattern = compiler.compile(argexp);
PatternMatcher matcher = new Perl5Matcher();
if(matcher.contains(str,pattern)) {
MatchResult result = matcher.getMatch();
for(int n = 0; n < result.length(); n++) {
System.out.println(result.group(n));
}
}else{
System.out.println("nothing");
}
}

}



查看完整回答
反對(duì) 回復(fù) 2022-05-10
?
守候你守候我

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超10個(gè)贊

java正則表達(dá)式就是定義某個(gè)固定格式的條件判斷,之后判斷某個(gè)對(duì)象是否符合這個(gè)規(guī)定的格式而出現(xiàn)的。
舉例:
package com;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TestRegex {
public static boolean isboolIP(String ipAddress){
String ip="(2[5][0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})";
Pattern pattern = Pattern.compile(ip);
Matcher matcher = pattern.matcher(ipAddress);
return matcher.matches();
}
/** * @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String ipAddress1 = "10.";
String ipAddress2 = "0.0.0.0";
String ipAddress3 = "255.255.255.255";
String ipAddress4 = "192.168.2.1";
String ipAddress5 = "26445687";
String ipAddress6 = "nihao";
String ipAddress7 = "你好??!";
if(isboolIP(ipAddress1)){
System.out.println("IP正確");
}else{
System.out.println("IP錯(cuò)誤");
} if(isboolIP(ipAddress2)){
System.out.println("IP正確"); }else{
System.out.println("IP錯(cuò)誤");
} if(isboolIP(ipAddress3)){
System.out.println("IP正確"); }else{
System.out.println("IP錯(cuò)誤");
}
if(isboolIP(ipAddress4)){
System.out.println("IP正確"); }else{
System.out.println("IP錯(cuò)誤");



查看完整回答
反對(duì) 回復(fù) 2022-05-10
  • 2 回答
  • 0 關(guān)注
  • 321 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)