Re: reg expression
by Corion (Patriarch) on Aug 29, 2011 at 08:39 UTC
|
The first step is to review your course material. It is quite unlikely that your teacher gives you homework that cannot be answered by the course material you have worked on so far.
| [reply] |
Re: reg expression
by MidLifeXis (Monsignor) on Aug 29, 2011 at 10:12 UTC
|
| [reply] |
|
|
sorry guys .. I am trying to learn based on examples , instead of reading books .
| [reply] |
|
|
sorry guys .. I am trying to learn based on examples , instead of reading books .
Books contain examples, and explanations of examples :)
perlintro, perlretut, perlrequick are all about examples
| [reply] |
Re: reg expression
by roboticus (Chancellor) on Aug 29, 2011 at 10:13 UTC
|
| [reply] [d/l] [select] |
Re: reg expression
by JavaFan (Canon) on Aug 29, 2011 at 11:25 UTC
|
A1: say "M K Gandhi" if /^\QMohandas Karamchand Gandhi\E\z/;
A2:
How are the clauses to be taken? Disjunctions? Conjunctions? Juxtapositions? The latter seems the most logical, but then, why not just use "followed by", which is used on clauses a) and b)? And since clause b) matches any string, disjunctions seems unlikely. Leaves us conjunctions. But then the answer ought to be: it's better done with three regular expressions. | [reply] [d/l] |
|
|
A2: How are the clauses to be taken? I think it are three separate questions a), b) and c).
CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
| [reply] |
|
|
I think it are three separate questions a), b) and c)
That's what I initially thought as well. But the question states a regular expression, not regular expressions. It also means the teacher likes trick questions, as the answer to b) is any pattern that matches the empty string. It doesn't mean you're wrong - I just didn't find it likely.
| [reply] |
|
|