Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #40342

Re: Help with regexp

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Help with regexp
Date 2021-08-11 16:03 +0200
Organization PointedEars Software (PES)
Message-ID <7288015.EvYhyI6sBW@PointedEars.de> (permalink)
References <lZadnd6QivChfpH8nZ2dnUU7-L3NnZ2d@westnet.com.au> <3136550.aeNJFYEL58@PointedEars.de> <F9SdnRF4Svb6AI38nZ2dnUU7-TPNnZ2d@westnet.com.au> <21167627.EfDdHjke4D@PointedEars.de> <slrnsh4s8a.49p.jon+usenet@raven.unequivocal.eu>

Show all headers | View raw


Jon Ribbens wrote:

> On 2021-08-10, Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote:
>><https://262.ecma-international.org/#sec-string.prototype.replace>
>> [… I for one cannot see anymore how that describes the (actual) behavior
>> of the “replace” method in this case.  Where is the check for RegExp?
>> Or are we supposed to use “replaceAll” now?
> 
> Step 2:
> 
>   If searchValue is neither undefined nor null, then
>     a. Let replacer be ? GetMethod(searchValue, @@replace).
>     b. If replacer is not undefined, then
>       i. Return ? Call(replacer, searchValue, « O, replaceValue »).
> 
> RegExp ojects have an @@replace method so that takes over the
> handling of the call. Interesting to know that you can presumably
> therefore create your own classes with @@replace methods to also
> affect the String replace method.

There it is:

<https://262.ecma-international.org/#sec-regexp.prototype-@@replace>

Thank you very much ':-)

> The abstractions in the ECMAScript standard aren't *too* bad I think.
> The effort required to find out what's happening in any particular
> situation doesn't normally seem to end up being overly burdensome.

I have been interpreting them since Edition 3 Final was published at
the latest, and in my opinion it gets worse with every new Edition :'-)


PointedEars
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Help with regexp Andrew Poulos <ap_prog@hotmail.com> - 2021-08-06 17:22 +1000
  Re: Help with regexp Andrew Poulos <ap_prog@hotmail.com> - 2021-08-06 17:41 +1000
    Re: Help with regexp Andrew Poulos <ap_prog@hotmail.com> - 2021-08-06 17:55 +1000
      Re: Help with regexp Julio Di Egidio <julio@diegidio.name> - 2021-08-06 01:39 -0700
        Re: Help with regexp Julio Di Egidio <julio@diegidio.name> - 2021-08-06 01:53 -0700
        Re: Help with regexp Andrew Poulos <ap_prog@hotmail.com> - 2021-08-07 09:19 +1000
          Re: Help with regexp Julio Di Egidio <julio@diegidio.name> - 2021-08-06 17:26 -0700
      Re: Help with regexp Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-08-06 10:36 +0000
        Re: Help with regexp Andrew Poulos <ap_prog@hotmail.com> - 2021-08-07 09:17 +1000
          Re: Help with regexp Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-08-07 18:57 +0000
  Re: Help with regexp The Natural Philosopher <tnp@invalid.invalid> - 2021-08-06 19:10 +0100
  Re: Help with regexp Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-08-07 21:56 +0200
    Re: Help with regexp Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-08-07 22:02 +0200
    Re: Help with regexp Andrew Poulos <ap_prog@hotmail.com> - 2021-08-09 13:13 +1000
      Re: Help with regexp Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-08-10 13:45 +0200
        Re: Help with regexp Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-08-10 12:28 +0000
          Re: Help with regexp Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-08-11 16:03 +0200

csiph-web