jfrm has asked for the wisdom of the Perl Monks concerning the following question:
Oh peaceful ones, I have an array @titles = qw/Mr Mrs Ms Miss Dr Sir Lord Lady Rev/; To avoid the darkness of repetition and exult the glory of elegance, I would like to use it in the following regexp instead of retyping all the array elements: $text =~ /^(Mr|Mrs|Ms|Miss|Sir|Lord|Lady|Dr|Rev)\s+(.*)/) Please can anyone empower me with the knowledge?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array within regexp?
by davido (Cardinal) on Feb 27, 2012 at 07:40 UTC | |
by ambrus (Abbot) on Feb 27, 2012 at 11:04 UTC | |
by jfrm (Monk) on Feb 27, 2012 at 11:12 UTC | |
by GrandFather (Saint) on Feb 27, 2012 at 21:24 UTC | |
|
Re: Array within regexp?
by johngg (Canon) on Feb 27, 2012 at 10:06 UTC | |
|
Re: Array within regexp?
by Anonymous Monk on Feb 27, 2012 at 15:09 UTC |