• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why is / a metachar in regular expressions ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is / a metachar in regular expressions ?


  • Subject: Re: Why is / a metachar in regular expressions ?
  • From: Rick Mann via Cocoa-dev <email@hidden>
  • Date: Wed, 18 Sep 2019 14:50:39 -0700

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
> <email@hidden> 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 where the substitution command is
>> "s/old/new/".
>
> Right, good point - same in vi and vim (the editor).
>
>>
>> So perhaps the underlying regex parser ignores "/" characters at the
>> start/end of the regex unless they're quoted?
>
> Maybe, but I couldn't find any hint in the docs.
>
>
>> 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
>
> Good point , but
> -  IIRC, vim, at least, uses backslash for that, e.g., \1 ,\2, etc.;
> -  furthermore, NSRegularExpression does not do any text replacement by
> itself, as far as I can see?
>
>
> Oh well, right now , I just don't escape any / , and it seems to work just
> fine.
>
>
> Best regards, Gabriel
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


--
Rick Mann
email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Why is / a metachar in regular expressions ?
      • From: Steve Mills via Cocoa-dev <email@hidden>
References: 
 >Why is / a metachar in regular expressions ? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: Why is / a metachar in regular expressions ? (From: Jens Alfke via Cocoa-dev <email@hidden>)
 >Re: Why is / a metachar in regular expressions ? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: Why is / a metachar in regular expressions ?
  • Next by Date: Re: Why is / a metachar in regular expressions ?
  • Previous by thread: Re: Why is / a metachar in regular expressions ?
  • Next by thread: Re: Why is / a metachar in regular expressions ?
  • Index(es):
    • Date
    • Thread