develooper Front page | perl.perl5.porters | Postings from August 2010

Re: Any opposition still to the idea of syntax indicating defaultregex modifiers?

Thread Previous | Thread Next
August 11, 2010 12:12
Re: Any opposition still to the idea of syntax indicating defaultregex modifiers?
Message ID:
karl williamson wrote:
>Here's my reasoning for excluding from consideration most of these. I've 
>scanned the tokenizer code, and there appear to be heuristics to decide 
>if something is an interpolated variable, the end of the pattern, and the 
>boundaries of character classes.  So it seems a lot less dangerous to 
>exclude $ % @ ; [ ]

$ % @ I agree with.

Why do you include semicolon?  I don't see a problem with it.

Brackets I think should be OK here if they're used in a paired way.
So not suitable for our current job, but potentially available for
something else.

>                     Also, quotes as you said, " ' `
>And, since / is the common regex delimiter, excluding it seems like a  
>good idea for human confusability issues,

I'd exclude / here, because we've got to leave some character that's
always available as a delimiter, and since / is the standard delimiter
I'd pick that one.  But " ' ` are *not* commonly quote characters for
regexps, so I don't think it's necessary to exclude them.  Indeed,
' is already used as a metacharacter in (?'NAME'pattern).

>                                          as well as anything that is a  
>paired delimiter, so } is out.

Yes, save that for paired usage.  {} pairs are already used in several
parts of regexp syntax, and I wouldn't want to use either of them in
any other way.  Both for mnemonic reasons and to avoid screwing up {}
quoting of regexps.

>                                Similar concerns get rid of \


>                                                               I'd  
>rather keep _ in reserve as it is a word character,

I was thinking _ would be a fairly good choice for our current use.
The spacer uses you suggest, or at least some of them, would probably be
better served by space characters and /x.  But I don't object to keeping
our hands off _ for now.

>I'd rather not use ^, again for human usability issues, as that often is  
>the first thing in a pattern.

I don't see a problem with (?^...) meaning something that has nothing
to do with the ^ anchor.

>                               A comma doesn't seem to me to convey the  
>right meaning,

Agreed.  Would be fine for some other use.

>                                       I didn't want to use tilde  
>because of the visual confusability with -,

As previously noted, I disagree with this being a problem.

>                                            and not * because of a  
>number of things that start like (*PRUNE),

I don't think that should stop us.  (?*...) is quite distinct from (*...).

>                                           so that left the period.

Period is fine.

For our present purpose, I'd be happy with any of

	_ ^ ~ * .


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About