Skip to content
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

Wishlist: (?(-1)yes-regexp) and (?(-2)yes-regexp|no-regexp) #11198

Closed
p5pRT opened this issue Mar 17, 2011 · 13 comments
Closed

Wishlist: (?(-1)yes-regexp) and (?(-2)yes-regexp|no-regexp) #11198

p5pRT opened this issue Mar 17, 2011 · 13 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 17, 2011

Migrated from rt.perl.org#86378 (status was 'open')

Searchable as RT86378$

@p5pRT
Copy link
Author

p5pRT commented Mar 17, 2011

From g+i@gameintellect.com

Hello Jon Allen,

I found a bug in a format of the conditional expressions, see
http​://perldoc.perl.org/perlretut.html#Conditional-expressions

There are superfluous parentheses around a condition​:

(?(condition)yes-regexp) and (?(condition)yes-regexp|no-regexp)

because the conditions already have parentheses​:

(integer)
(?=...) etc.

The format of the conditional expression should be

(? condition yes-regexp) and (? condition yes-regexp|no-regexp)

By the way​: how about relative backreferences as a condition?
I think, it would be great, if we can use such conditional expressions​:

(?(-1)yes-regexp) and (?(-2)yes-regexp|no-regexp)

--
Regards
Serge

@p5pRT
Copy link
Author

p5pRT commented Mar 18, 2011

From @briandfoy

In article <rt-3.6.HEAD-4136-1300351559-1942.86378-75-0@​perl.org>,
Serge <perlbug-followup@​perl.org> wrote​:

# New Ticket Created by Serge
# Please include the string​: [perl #86378]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=86378 >

Hello Jon Allen,

I found a bug in a format of the conditional expressions, see
http​://perldoc.perl.org/perlretut.html#Conditional-expressions

There are superfluous parentheses around a condition​:

(?(condition)yes-regexp) and (?(condition)yes-regexp|no-regexp)

because the conditions already have parentheses​:

(integer)
(?=...) etc.

I think the current form is correct, and the part you think is odd is
explained in the sentence starting with "The second form is". I'd leave
the parens around "condition" to emphasize that some parens will be
there, no matter the source.

@p5pRT
Copy link
Author

p5pRT commented Mar 18, 2011

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Mar 18, 2011

From @demerphq

On 18 March 2011 06​:41, brian d foy <brian.d.foy@​gmail.com> wrote​:

In article <rt-3.6.HEAD-4136-1300351559-1942.86378-75-0@​perl.org>,
Serge <perlbug-followup@​perl.org> wrote​:

# New Ticket Created by  Serge
# Please include the string​:  [perl #86378]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=86378 >

Hello Jon Allen,

 I found a bug in a format of the conditional expressions, see
http​://perldoc.perl.org/perlretut.html#Conditional-expressions

 There are superfluous parentheses around a condition​:

(?(condition)yes-regexp) and (?(condition)yes-regexp|no-regexp)

because the conditions already have parentheses​:

(integer)
(?=...) etc.

I think the current form is correct, and the part you think is odd is
explained in the sentence starting with "The second form is". I'd leave
the parens around "condition" to emphasize that some parens will be
there, no matter the source.

I concur. The documentation is correct.

The prefix that denotes this construct is​:

(?(

The paren is NOT part of the condition, it is part of the regex syntax.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2012

From @doy

Closing.

-doy

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2012

From [Unknown Contact. See original ticket]

Closing.

-doy

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2012

@doy - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Jul 4, 2012
@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2012

From @cpansprout

On Tue Jul 03 18​:16​:04 2012, doy wrote​:

Closing.

I think you missed the fact that this ticket contains two separate
issues​: 1) the doc bug, which wasn’t a bug, and 2) a wishlist item​:
support for (?(-1)...).

The second has not been implemented or rejected.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2012

From [Unknown Contact. See original ticket]

On Tue Jul 03 18​:16​:04 2012, doy wrote​:

Closing.

I think you missed the fact that this ticket contains two separate
issues​: 1) the doc bug, which wasn’t a bug, and 2) a wishlist item​:
support for (?(-1)...).

The second has not been implemented or rejected.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2012

@doy - Status changed from 'resolved' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2012

From @doy

On Tue, Jul 03, 2012 at 08​:35​:43PM -0700, Father Chrysostomos via RT wrote​:

On Tue Jul 03 18​:16​:04 2012, doy wrote​:

Closing.

I think you missed the fact that this ticket contains two separate
issues​: 1) the doc bug, which wasn’t a bug, and 2) a wishlist item​:
support for (?(-1)...).

The second has not been implemented or rejected.

Ah, I did miss that part, thanks.

-doy

@p5pRT
Copy link
Author

p5pRT commented Jun 30, 2013

From @jkeenan

On Tue Jul 03 20​:39​:14 2012, doy@​tozt.net wrote​:

On Tue, Jul 03, 2012 at 08​:35​:43PM -0700, Father Chrysostomos via RT
wrote​:

On Tue Jul 03 18​:16​:04 2012, doy wrote​:

Closing.

I think you missed the fact that this ticket contains two separate
issues​: 1) the doc bug, which wasn’t a bug, and 2) a wishlist item​:
support for (?(-1)...).

The second has not been implemented or rejected.

Ah, I did miss that part, thanks.

-doy

When this ticket was originally opened in March 2011, the wishlist item
Father C refers to was​:

#####
By the way​: how about relative backreferences as a condition?
I think, it would be great, if we can use such conditional expressions​:

(?(-1)yes-regexp) and (?(-2)yes-regexp|no-regexp)
#####

No one has seconded the motion for this feature request in over two years.

Is there anyone who feels it ought to be implemented?

Is there anyone who is willing to take on the task of implementing it?

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Jun 30, 2013

From @cpansprout

On Sat Jun 29 17​:33​:57 2013, jkeenan wrote​:

On Tue Jul 03 20​:39​:14 2012, doy@​tozt.net wrote​:

On Tue, Jul 03, 2012 at 08​:35​:43PM -0700, Father Chrysostomos via RT
wrote​:

On Tue Jul 03 18​:16​:04 2012, doy wrote​:

Closing.

I think you missed the fact that this ticket contains two separate
issues​: 1) the doc bug, which wasn’t a bug, and 2) a wishlist item​:
support for (?(-1)...).

The second has not been implemented or rejected.

Ah, I did miss that part, thanks.

-doy

When this ticket was originally opened in March 2011, the wishlist item
Father C refers to was​:

#####
By the way​: how about relative backreferences as a condition?
I think, it would be great, if we can use such conditional expressions​:

(?(-1)yes-regexp) and (?(-2)yes-regexp|no-regexp)
#####

No one has seconded the motion for this feature request in over two years.

Is there anyone who feels it ought to be implemented?

Is there anyone who is willing to take on the task of implementing it?

Consider me willing, but also consider that it is at the bottom of by
list. :-)

I think it would be a very handy feature. Leaving it open keeps it on
the general to-do list.

--

Father Chrysostomos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant