New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/(? :o)/: Sequence (? ...) not recognized, when using /x. #2368
Comments
From @AbigailCreated by @Abigail $ perl -wle '"foo" =~ /(? :o)/x' But 'man perlre' writes: The `/x' modifier itself needs a little more explanation. Either the doc is wrong, or the regular expression parser. Fixing The Camel III doesn't mention the restriction on placing whitspace either. Perl Info
|
From @vanstynIn <20000815160207.13763.qmail@foad.org>, abigail@foad.org writes: Hmm, how far do we want to go with this? Anything in regcomp.c that Hugo |
From [Unknown Contact. See original ticket]Hugo <hv@crypt.compulink.co.uk> wrote
It should skip whitespace almost everywhere. I'd suggest the within numbers (i.e. your two cases '.{1 0}' and '\1 0') within character classes after \ Mike Guy |
From [Unknown Contact. See original ticket]Hugo wrote: Using /x turns non-class whitespace that would otherwise match itself into But then, by that logic, it would seem consistant for /x? ?/x to remain |
From [Unknown Contact. See original ticket]Jeffrey Friedl <jfriedl@yahoo-inc.com> wrote
That's thinking in terms of the implementation rather than the intent /x was intended to mean and should mean "ignore whitespace and # comments". Mike Guy |
I cant decide what to do about this. On one hand I personally see metapatterns like '(?>' as indivisible symbols, much as '++' is indivisible in perl. ( So we have an awkward set of precedent here, and some imo difficult decisions. It is likely relatively simple to support whitespace in more places, but I really question whether we should. Regardless if we don't we should fix the docs to explain the subtleties here. |
I have a bias about this issue from my experience in Fortran. It was a serious mistake they made in not requiring white space between tokens. It's been a long time since I looked at this but a classic example was fori1ton. or something like that could have been a for loop, or a variable name. I thought language design had learned from that lesson. '+ +' is more obscure than ++. I don't believe we should take any extra steps towards enabling obscure expressions of intent. |
Closing as not-a-bug. |
Note, I have filed a doc fix related to this as #20790 and I am reopening until it is applied. |
Migrated from rt.perl.org#3697 (status was 'open')
Searchable as RT3697$
The text was updated successfully, but these errors were encountered: