Dear Jean-Christophe,
While it may be possible to use them to create patterns that are 
functionally equivalent, it is these cases that are marginal, and the 
operators themselves should by no means be considered as equivalent. One 
defines two alternative patterns, while the other defines a character 
class. When we observe, for example, that the expression a|b does the same 
thing as [ab], this is simply because it is no easier to define certain 
small, simple classes than to enumerate their members, but what about 
[a-z], or [^a]? Not only would you be up all night listing all the 
characters that are not lowercase a, but you'd end up with a significantly 
less than optimal expression.
Parsimony aside, since the pipe defines alternative *patterns*, there is no 
way to create patterns like (dog|cat) using character classes. 

On Monday, May 8, 2017 at 10:10:45 PM UTC-4, Jean-Christophe Helary wrote:
>
> I'm wondering if [] and | are equivalent for single characters or if there 
> are marginal cases where they would not be equivalent ? 
>
> Jean-Christophe

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to