That's what I wanted to know. I find it hard to come up with definitions of 'match' and 'position' that justify this result.
Henry Rich On Thu, Mar 17, 2022, 1:21 PM Raul Miller <[email protected]> wrote: > On Thu, Mar 17, 2022 at 12:45 PM Henry Rich <[email protected]> wrote: > > What does regex do with a situation like this? > > Hmm... there's a couple issues here, one has to do with how rplc > (stringreplace) handles ambiguous matches: > > (;:'b B1 b B2') stringreplace 'abc' > aB1c > > So when we have supplied multiple matches for the same substring, we > use the first match, very much how indices work. The difference is > that substrings have arbitrary lengths. > > But this would also mean that > ('';'+';'';'-') stringreplace 'ab' > > should be equivalent to > ('';'+') stringreplace 'ab' > > So, dipping into perl (which is the original source for our regex > implementation): > > perl -e '$_="ab"; s//+/g; print' > +a+b+ > > Is that what you were looking for? > > Thanks, > > -- > Raul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
