Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: book vs. web for Perl Regex study?

by dHarry (Abbot)
on Sep 02, 2010 at 11:20 UTC ( [id://858553]=note: print w/replies, xml ) Need Help??


in reply to book vs. web for Perl Regex study?

How can you study Java and not encounter regular expressions??? Maybe it's time to take the lesson again:P

I was delighted when it was added, though I think it's fair to say that compared to Perl the Java way of working with it is (a bit...) cumbersome. Take for example the following snippet.

import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class BLA { public static final String BLA_PATTERN = "\"([^\"]+?)\",?|([^,]+),?| +,"; private static Pattern blaRE; public BLA() { blaRE = Pattern.compile(BLA_PATTERN); } public List<String> parse(String line) { List<String> list = new ArrayList<String>(); Matcher m = blaRE.matcher(line); while (m.find()) { // do stuff } return list; } }

In Perl this would be just one line:)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://858553]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 01:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found