Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Regex, the jungle survival skill

by kcott (Archbishop)
on Mar 10, 2016 at 07:22 UTC ( [id://1157264]=note: print w/replies, xml ) Need Help??


in reply to Regex, the jungle survival skill

G'day mmkstarr,

Welcome to the Monastery.

"I am wondering how far one can get in pearl without learning regex?"

[Note: the language is called Perl and the program is called perl. A "pearl" is something you'll find in an oyster.]

Perl provides much the same constructs as other programming languages. (See "perlintro -- a brief introduction and overview of Perl".) You can write Perl code without using regexes. However, unless you're coding in total isolation, you will often encounter regexes in code written by others: without being able to understand regexes, you won't get very far. As an absolute bare minimum, I suggest you read, and fully comprehend:

"Is regex fluency a huge boon to a perl user?"

The short answer is: "Yes". Regexes allow you to write very succinct code, often in a single line, which otherwise would require dozens, or even hundreds, of lines of code to accomplish.

Having said that, it's important not to fall into the trap of always reaching for a regex just because it can be used. Perl provides a number of functions and operators which may be more appropriate than a regex and, more often than not, are much faster than the equivalent regex. Here's some examples:

"If so, what are some of the best regex tutorials you have come upon?"

In the first instance, I suggest you look at:

There's a lot of documentation on Perl's regular expressions. Use the following, as required, for reference:

— Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-04-26 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found