April 4th, 2002, 01:24 PM
Regular Expressions in java
Alright, guys I haven't used Java in over three years and I need some help. I've been assinged the task of creating a java servlet with upload capabilities. Now I've already searched the site and I see a number of solutions for uploading. My problem is, after I get this file, I need to do a lot of adjustments to it. This would be super easy in perl, but we're trying not to introduce too many technologies to solve the problem. Here are my questions.
1. Does Java have regular expressions? (although the 1000+ page tome I have doesn't mention it, I'd like to know for sure).
2. If Java doesn't have regular expressions, can the perl interpreter be embedded into java so that I can access perl's functionality (I know that this can be done in C).
3. If no. 2 isn't possible, can java kick off a system command (which in this case could be a perl script). Again, the tome I have doesn't mention a java class to handle system commands.
Obviously I'd like choice number one to be available to me because I don't want the overhead of loading the perl script into memory every time. Any help would be greatly appreciated. Thanks in advance.
April 4th, 2002, 01:33 PM
google is your friend. Next time start there.
which was result 5 when I searched for "java regular expressions"
So, no, java doesn't come with regular expressions by default.
April 4th, 2002, 02:44 PM
April 4th, 2002, 05:15 PM
Isn't regular exp. built into 1.4?
April 5th, 2002, 12:10 PM
Actually, it looks like they do. From what I see, however (and I haven't really looked at it to much, so I'm probably wrong), it looks like the reg ex package created by apache is more extensive. Anyway, the good thing is that there are solutions out there. Thanks, guys.
April 5th, 2002, 12:13 PM
As usual, I'm completely wrong. At least I'm consistent at something. Although the 1.4 syntax is different to the reg ex package created by apache, it looks to be just as robust. I'll say no more about this!
April 5th, 2002, 03:16 PM
I'm glad you checked this out. I'm going to be building a log parser in Java, and needed a Regex package. I was originally going to use Apache's solution, but since this is built right in and I'm running 1.4, I'll use this instead.
July 31st, 2002, 08:39 AM
July 31st, 2002, 10:50 PM
Java 1.4 does add regular expressions. There are actually two jakarta regex packages. regexp like two posters mentioned and also ORO (http://jakarta.apache.org/oro/) ORO is more complete than regexp and I think is more like Perl's pattern matching.
August 2nd, 2002, 01:21 AM