It was a bit long winded, sorry.
Actually both the to be matched and target are both varialbes. Prior to my
previous mail I tried
String V = "abc";
String W = "abc_somthing";
RE r2 = new RE(V);
boolean matched2 = r2.match("^"+W);
and it did not work (compiler did not complian, but the search result
incorrect) I wasn't sure it that is legal because it was not mentioned in
the apidoc. After Scott's mail, I tried the other way round,
String V = "abc";
String W = "abc_somthing";
RE r2 = new RE(V);
boolean matched2 = r2.match("^"+W);
and this time it worked. Thanks Scott and I will try to be concise next
time :-).
michael
> Try rephrasing your question to:
>
> How do I join the String "^" to the String referenced by the
> variable V?
>
> Hint: Something to do with "+".
>
> Scott
> --
> Scott Eade
> Backstage Technologies Pty. Ltd.
> http://www.backstagetech.com.au
> .Mac Chat/AIM: seade at mac dot com
>
>
> On 2/01/2003 11:39 AM, "Eigen Technology Pty Ltd"
> <[EMAIL PROTECTED]> wrote:
>
>> Turbine uses Regexp and I have a question on Regexp:
>>
>> A simple usage of Regexp is:
>>
>> RE r2 = new RE("abc");
>> boolean matched2 = r2.match("abc_match_it");
>>
>> if I want to use a variable instead:
>>
>> String V = "abc";
>> RE r2 = new RE(V);
>> boolean matched2 = r2.match("abc_match_it");
>>
>> Now, if I what to match this at the begining of the line with a
>> variable, I have a problem. ^ - is used to represent the begining of a
>> line, but how do I use it in conjunction with a variable? I tried:
>>
>> RE r2 = new RE(^V);
>> RE r2 = new RE("^V");
>> RE r2 = new RE("^"V);
>> RE r2 = new RE("^""V");
>>
>> Java compiler does not link any of these....It works if I do not use
>> variables:
>>
>> String V = "^abc";
>>
>> is OK. Alternativly, I could probably apply a chain rule, but I don't
>> know how to do this.
>>
>> Any suggestions?
>>
>> michael
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <mailto:[EMAIL PROTECTED]> For additional
>> commands, e-mail: <mailto:[EMAIL PROTECTED]>
>>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]> For additional
> commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>