Re: Why is / a metachar in regular expressions ?

2019-09-21 Thread Gabriel Zachmann via Cocoa-dev
>> >> Yeah, I'm inclined to think it's an error in the docs. > > If you look at the input expression in this great site, you'll see 2 /'s as > part of it. They mark the beginning and the end (before flags). > > https://regexr.com > OTOH, the doc of NSRegularExpression specifically links to

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Saagar Jha via Cocoa-dev
If you need any more confirmation, Swift’s NSRegularExpression escapes this exact set of characters , so there isn’t an error in the

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Rick Mann via Cocoa-dev
Ah! So it is. Definitely not an error in the docs, assuming NSRegularExpression supports flags. > On Sep 18, 2019, at 14:54 , Steve Mills via Cocoa-dev > wrote: > > On Sep 18, 2019, at 16:50:39, Rick Mann via Cocoa-dev > wrote: >> >> Yeah, I'm inclined to think it's an error in the docs. >

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Steve Mills via Cocoa-dev
On Sep 18, 2019, at 16:50:39, Rick Mann via Cocoa-dev wrote: > > Yeah, I'm inclined to think it's an error in the docs. If you look at the input expression in this great site, you'll see 2 /'s as part of it. They mark the beginning and the end (before flags). https://regexr.com -- Steve

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Rick Mann via Cocoa-dev
Yeah, I'm inclined to think it's an error in the docs. > On Sep 18, 2019, at 14:43 , Gabriel Zachmann via Cocoa-dev > wrote: > >>> I don't see why / is a meta character. >>> It does not appear anywhere else in the documentation as metacharacter. >> >> In some languages "/" is used as the

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Gabriel Zachmann via Cocoa-dev
>> I don't see why / is a meta character. >> It does not appear anywhere else in the documentation as metacharacter. > > In some languages "/" is used as the delimiter to begin/end a regular > expression, for example in sed where the substitution command is "s/old/new/". Right, good point -

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Rick Mann via Cocoa-dev
Is it used to refer to groups in text replacement? Sometimes that's a dollar sign, sometimes a slash, but I thought it was a backslash. > On Sep 18, 2019, at 13:51 , Jens Alfke via Cocoa-dev > wrote: > > > >> On Sep 18, 2019, at 1:45 PM, Gabriel Zachmann via Cocoa-dev >> wrote: >> >> I

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Jens Alfke via Cocoa-dev
> On Sep 18, 2019, at 1:45 PM, Gabriel Zachmann via Cocoa-dev > wrote: > > I don't see why / is a meta character. > It does not appear anywhere else in the documentation as metacharacter. In some languages "/" is used as the delimiter to begin/end a regular expression, for example in sed

Why is / a metachar in regular expressions ?

2019-09-18 Thread Gabriel Zachmann via Cocoa-dev
In the doc for NSRegularExpression, it says "Characters that must be quoted to be treated as literals are * ? + [ ( ) { } ^ $ | \ . / " I don't see why / is a meta character. It does not appear anywhere else in the documentation as metacharacter. (Also not at