No.
Check source code for verification
soluzione: pratica La sua non è standard, ma è possibile utilizzare questo risultato ottenere.
Aggiornamento:
CharSequence inputStr = "abcabcab283c";
String patternStr = "[1-9]{3}";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(inputStr);
if(matcher.find()){
System.out.println(matcher.start());//this will give you index
}
O
Regex r = new Regex("YOURREGEX");
// search for a match within a string
r.search("YOUR STRING YOUR STRING");
if(r.didMatch()){
// Prints "true" -- r.didMatch() is a boolean function
// that tells us whether the last search was successful
// in finding a pattern.
// r.left() returns left String , string before the matched pattern
int index = r.left().length();
}
fonte
2010-11-16 12:55:32
C'è qualche soluzione per implementare questo? – Roshan
@ org.life.java - Che libreria stai usando qui? Regex non è nelle librerie java standard. –
@Stephen C Grazie, l'ho seguito su http://www.javaregex.com/ Non sono sicuro che sia affidabile o meno. Non l'ho usato personalmente, ho imparato dal suo tutorial –