John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
If I write $r= qr/this-stuff $more/x where $more may be empty or contain "| more-stuff", then $more is a string not a regex. I suppose I could, but I'd have to be more careful about piecing together a string first that will then be compiled. If I had $r= qr/this-stuff | $more/x; and made $more another qr like I want, then I can't get rid of the | in the main level. My current thought is to make $more point to either the optional stuff OR in the off mode contain something that always fails. Seems awkward though.
Any other suggestions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Composing regex's dynamically
by Corion (Patriarch) on Apr 27, 2011 at 12:37 UTC | |
by John M. Dlugosz (Monsignor) on Apr 27, 2011 at 13:48 UTC | |
by Corion (Patriarch) on Apr 27, 2011 at 13:52 UTC | |
by John M. Dlugosz (Monsignor) on Apr 27, 2011 at 15:41 UTC | |
by Corion (Patriarch) on Apr 27, 2011 at 16:05 UTC | |
| |
|
Re: Composing regex's dynamically
by RMGir (Prior) on Apr 27, 2011 at 12:54 UTC | |
|
Re: Composing regex's dynamically
by JavaFan (Canon) on Apr 28, 2011 at 15:13 UTC | |
by John M. Dlugosz (Monsignor) on Apr 28, 2011 at 20:57 UTC | |
by JavaFan (Canon) on Apr 28, 2011 at 22:28 UTC | |
by John M. Dlugosz (Monsignor) on Apr 28, 2011 at 23:37 UTC | |
by JavaFan (Canon) on Apr 29, 2011 at 09:51 UTC | |
|