<div dir="ltr"><div dir="ltr">On Tue, 5 Nov 2019 at 06:42, Giles Orr <<a href="mailto:gilesorr@gmail.com">gilesorr@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Tue, 5 Nov 2019 at 01:47, William Park via talk <<a href="mailto:talk@gtalug.org" target="_blank">talk@gtalug.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">0 or 1 match is ?<div id="gmail-m_4587464695754149228gmail-m_6691676317069844371yMail_cursorElementTracker_1572936212991">Eg.  echo /aaa/.bbb//ccc/123 | sed 's,\(/\.\?[^/]\)[^/]*,\1,g'</div><div id="gmail-m_4587464695754149228gmail-m_6691676317069844371yMail_cursorElementTracker_1572936229882">--William</div></blockquote><div><br></div><div>Nice - that works too.</div><div><br></div><div>Jeez regex is a pain - it took three minutes of staring at that just to figure it out, even though I knew what we were both trying to achieve.<br></div></div></div></blockquote><div><br></div><div>PS.  Yours works better: mine fails on the double slash '//' because it insists on looking for a non-slash item right after it and so produces '/a/.b///1' when it should have given me '/a/.b//c/1' as yours did.  It's somewhat academic as in processing prompts the regex should never encounter two slashes with nothing between them, but ... I prefer the more correct answer.  Thanks.<br></div></div><div><br></div><div>-- </div><div dir="ltr" class="gmail_signature">Giles<br><a href="https://www.gilesorr.com/" target="_blank">https://www.gilesorr.com/</a><br><a href="mailto:gilesorr@gmail.com" target="_blank">gilesorr@gmail.com</a></div></div>