java regular expressions

cfleck

tired
so i'm trying to use project buider to build a java swing app and i want to use the regular expression package that is in java.

i can use regex stuff if i just make a "boring" cli app and it compiles and runs fine.

when i try to do it using the swing app template in project builder it pukes when it tries to run. it builds fine, just wont run. i'm new to pb so i could be doing something wrong. can you help me? here is the practical code...

PHP:
import java.util.Locale;
import java.util.ResourceBundle;
import java.awt.*;
import java.awt.event.*;
import com.apple.mrj.*;
import javax.swing.*;
import java.util.regex.*;

PHP:
public void paint(Graphics g) {
        super.paint(g);
        g.setColor(Color.blue);
        g.setFont (font);
        g.drawString(regTest("",""), 40, 80);
    }

    public String regTest(String query, String word){
        Pattern p = Pattern.compile("a*b");
        Matcher m = p.matcher("aaab");
        boolean b = m.matches();
        
        if(b){ return "aaab"; }
        else { return "boo";}
    }
	
    public static void main(String args[]) {
        new RegEx();
    }

}
 
Back
Top