954,219 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

matching regular expressions

Hi there,

First off I'm new to java and coding in general so please bear with me. I'm trying to write a bit of code that will convert something like the following
con(pk(B),pk(AS),pk(A),B)
to this
k_B, k_AS, k_A, B

I have written the following code :

Pattern pk = Pattern.compile("pk(.*)"); //Regular Expression Pattern

int varsLen = initialVars.length();
String[] elements = initialVars.split(","); //Split up the terms
for (int x=0; x

macca1979
Newbie Poster
6 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

I think you should use the string tokenizer for the following expression .. it'll be much easier for you to code.

nanosani
Unauthenticated Liar
Team Colleague
1,830 posts since Jul 2004
Reputation Points: 45
Solved Threads: 56
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You