Hi.
The problem is that the '^' implicitly matches the first char, so when you call subst 
it replaces that first char with the expression.
One possible solution is to keep that first char so you can add it to the end of the 
replacing text:
 ...
        motor2 = new RE("(^.)");
        motor2.match("test.me");
        // get the expression inside parens
        String firstChar = motor2.getParen(1);
        // add it to the replacing text
        String out = motor2.subst("test.me", "http://"; + firstChar);
        System.out.println(out);
 ...
        Out:

      http://test.me

Rui Duarte

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: terça-feira, 25 de Fevereiro de 2003 9:05
To: [EMAIL PROTECTED]
Subject: Problem with start of line "^" RE and subst 


Hi!

I have the problem that I receive urls without "http://"; part, so I used 
"^" as match and "http://"; as replacement in RE.subst

No that I call myre.subst("test.me","http://";) it comes out as 
"http://est.me"; and the "t" is missing. 

What's wrong? 

Harry

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to