Sponsored Content
Top Forums Programming Which language is best suited for regular expressions perl,python.ruby ? Post 302412187 by pludi on Monday 12th of April 2010 03:34:53 AM
Old 04-12-2010
(Disclaimer: If it seems like I'm favouring Perl here it's because I couldn't code in Python or Ruby if my life depended on it)

Best answer I can give you: it depends. All three languages have their pros and cons, but the weight of each depends on what you want to do, and what you already know.

Perl: evolved out of awk, sed, C, and a few others. The syntax is very relaxed, and the "credo" is There Is More Than One Way To Do It. Libraries are available as "Packages", with a large collection at the CPAN (Comprehensive Perl Archive Network), and are used via the use keyword.

Python: an (almost) completely object-oriented language. Blocks of code are organized through indentation levels. Syntax is quite strict. Libraries are available as "Modules" and are used via the import keyword.

Ruby: (largely) a mix of Perl and Smalltalk. Syntax is similar to Perl, with the difference that all datatypes are objects, and can have methods invoked on them. Libraries are largely available through the RubyGems application, which is similar to CPAN and apt-get.

My suggestion would be: go through the tutorials for all three languages, and choose the one where the usage best fits the way you think.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl regular expressions...

I am writing script that will act like the 'comm' utility. My problem is when trying to read whether the user has entered -123 or -1 or -1...etc. I currently have: if(m/??/g){ print "Good.\n"; } So, this should check for all... (1 Reply)
Discussion started by: DrRo183
1 Replies

2. UNIX for Dummies Questions & Answers

Regular Expressions HELP - PERL

Hello, $line=USING (FILE '/TEST1/FILENAME'5000) I want to reterive the value between ' and ) which is 5000 here. i have tried out the following expressions ... Type 1 : $Var1=`sed -e 's/.*\' //' -e 's\).*$/' $line`; Type 2 : $Var1=`echo $line | awk -F"\'" '{print $2}' | awk -F"\\)"... (1 Reply)
Discussion started by: maxmave
1 Replies

3. Shell Programming and Scripting

Regular Expressions HELP - PERL

Hello, $line=USING (FILE '/TEST1/FILENAME'5000) I want to reterive the value between ' and ) which is 5000 here. i have tried out the following expressions ... Type 1 : $Var1=`sed -e 's/.*\' //' -e 's\).*$/' $line`; Type 2 : $Var1=`echo $line | awk -F"\'" '{print $2}' | awk -F"\\)"... (3 Replies)
Discussion started by: maxmave
3 Replies

4. Shell Programming and Scripting

perl regular expressions and field search

Hello guys/gals, i am sorry as this is probably very simply but i am slowly learning perl and need to convert some old korn shell scripts. I need to be able to search a file line by line but only match a string at particular location on that line, for example character 20-30. So my file... (4 Replies)
Discussion started by: dynamox
4 Replies

5. Shell Programming and Scripting

Regular expressions - Perl

Hello everybody, I am trying to connect from hp-ux to win 2003 using perl's Net::Telnet module. Seeing the examples in couple of web sites, I saw I have to declare a Prompt => Can somebody please tell me what my regular expression should be? The prompt after I log in is: ... login:... (1 Reply)
Discussion started by: whatever
1 Replies

6. Shell Programming and Scripting

regular expressions using perl script

i have a set of regular expressions. The words in the regular expression should be used to replace the i/p with hyphens '---'. i need perl script to evaluate these regular expression. the words in the regexes when found in the i/p file should be replaced with hyphens '---'. the set of regular... (3 Replies)
Discussion started by: Sgiri1
3 Replies

7. Shell Programming and Scripting

Perl regular expressions don't like the @ ("at") sign.

Take a look at this code: #!/usr/bin/perl use 5.008; $_ = "somename@address.com"; if(/\@\w+\.com/) { print "\n\nmight be an email address\n\n"; } else { print "\n\nnot an email address\n\n"; } Shouldn't the /\@\w+\.com/ evaluate as true? I've also tried: ... (3 Replies)
Discussion started by: mrwatkin
3 Replies

8. Shell Programming and Scripting

Perl - Regular Expressions - Match complete word only

Hi Team, I have two strings like: xxx|yyy|Arizona Cardinals| Tell Cardinals | Cardinals bbb|Bell Earn, Jr | Bell Earn | Jayhawks | hawks I have a lookup file which has a set of strings. These need to be removed from above two strings Lookup file Contents: Bell Earn, Jr hawks... (2 Replies)
Discussion started by: forums123456
2 Replies

9. Shell Programming and Scripting

PERL Regular Expressions

im trying to extract some tags between and in a file..for eg..the file format is I want the and extracted from the file i.e the tags which is present b/w and I have the regex for extracting the tags from the whole file but how to specify my search within the and... (1 Reply)
Discussion started by: rajkrishna89
1 Replies

10. Shell Programming and Scripting

awk or sed or python for regular expressions ?

Linux 6.X environments (RHEL, Oracle Linux ) I could write basic shell scripts in bash. In my spare time, I was planning to learn awk or sed to deal with regular expression tasks I have to deal with. But, I gather that python is gaining popularity these days and I came to know that python has a... (5 Replies)
Discussion started by: John K
5 Replies
XmFontListNextEntry(library call)										 XmFontListNextEntry(library call)

NAME
XmFontListNextEntry -- A font list function that returns the next entry in a font list SYNOPSIS
#include <Xm/Xm.h> XmFontListEntry XmFontListNextEntry( XmFontContext context); DESCRIPTION
XmFontListNextEntry returns the next entry in the font list. The application uses the XmFontListInitFontContext routine to create a font list context. The first call to XmFontListNextEntry sets the context to the first entry in the font list. The application then calls XmFontListNextEntry repeatedly with the same context. Each succeeding call accesses the next entry of the font list. When finished, the application calls XmFontListFreeFontContext to free the allocated font list context. context Specifies the font list context RETURN
Returns NULL if the context does not refer to a valid entry or if it is at the end of the font list; otherwise, it returns a font list entry. If the function does return a font list entry, the font list entry is not a copy. Therefore, the application should not free the returned font list entry. RELATED
XmFontList(3), XmFontListEntryFree(3), XmFontListEntryGetFont(3), XmFontListEntryGetTag(3), XmFontListFreeFontContext(3), and XmFontLis- tInitFontContext(3). XmFontListNextEntry(library call)
All times are GMT -4. The time now is 06:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy