About Regex Pattern Match?
Hi all,
i am getting the exception,
java.util.regex.PatternSyntaxException: Illegal character range near index 47
[* &Com::Vwr::Web::HTML::Embperl::Execute($app->include_file_name('header'),$app,
^
at java.util.regex.Pattern.error(Pattern.java:1541)
at java.util.regex.Pattern.range(Pattern.java:2128)
at java.util.regex.Pattern.clazz(Pattern.java:2069)
at java.util.regex.Pattern.sequence(Pattern.java:1598)
at java.util.regex.Pattern.expr(Pattern.java:1558)
at java.util.regex.Pattern.compile(Pattern.java:1291)
at java.util.regex.Pattern.<init>(Pattern.java:1047)
at java.util.regex.Pattern.compile(Pattern.java:785)
at java.lang.String.replaceFirst(String.java:1630)
at regexTestNB.processAttribute(regexTestNB_test.java:189)
at regexTestNB.processSegment(regexTestNB_test.java:132)
at regexTestNB.<init>(regexTestNB_test.java:85)
at regexTestNB.main(regexTestNB_test.java:569)
I am Reading the string :
[* &Com::Vwr::Web::HTML::Embperl::Execute($app->include_file_name('header'),$app, "VWR.COM - VWR International Catalogs"); *]
Here is MY Code:
String regexforPerlAttribute = "\".*?\"";
Matcher perlMatcher = Pattern.compile(regexforPerlAttribute,Pattern.DOTALL|Pattern.CASE_INSENSITIVE).matcher(text);
String[] PerlPlaceHolder = new String[0];
String textwithStartPH = "";
int i = 0;
while(perlMatcher.find()){
String firstPH = text.substring(index,perlMatcher.start());
PerlPlaceHolder = firstPH;
i ++ ;
textwithStartPH = text.replaceFirst(firstPH, PLACEHOLDER);
String attVal = perlMatcher.group();
textwithStartPH = textwithStartPH.concat(attVal);
//constructSegments(attVal,writer);
index = perlMatcher.end();
}
It shows exception at$app-> character
I am reading the value between double quotes.
Please help me.
Thanx,
Vinayak
Message was edited by:
VinuRocks
Message was edited by:
VinuRocks

