<div dir="ltr">Hi Hartmut<div><br></div><div>I am not familiar with your replacement syntax <span style="color:rgb(0,0,0);font-family:verdana,sans-serif">\1\s0\2\s</span></div><div><br></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">Rubular shows the groups as:<br></span></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">1 </span><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">From AncientBBS1</span></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">2 </span><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">Thu</span></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">3 </span><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">Jan</span></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">and 3 others</span></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif"><br></span></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">and for the truncated expression:</span></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">1 Jan</span></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">2 2</span></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif"><br></span></div><div><span style="color:rgb(0,0,0);font-family:verdana,sans-serif">I find rubular a convenient online tool for checking regex</span></div><div><a href="https://rubular.com/">https://rubular.com/</a><span style="color:rgb(0,0,0);font-family:verdana,sans-serif"><br></span></div><div><br></div><div>-Dan</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 4, 2020 at 10:27 AM Hartmut W Sager <<a href="mailto:hwsager@marityme.net">hwsager@marityme.net</a>> wrote:<br></div><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 class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">This might be the wrong time of night for doing regex (i.e., my mistake), or my trusty Vedit text editor has a bug in its regex implementation.<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> <br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Original search string: ^(From AncientBBS[1-2])\s+(Sun|Mon|Tue|Wed|Thu|Fri|Sat)[\s\,]+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+([0-9][0-9]|\s[0-9])[\s\,]+(19[0-9][0-9])[\s\,]+([0-9][0-9]\:[0-9][0-9]\:[0-9][0-9])\s*$</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Replacement string: <Nah, skip it><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> <br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">The above search string gives a syntax error. I am a bit suspicious of the
([0-9][0-9]|\s[0-9]) group re operator precedence of the "or", and proceeded to stepwise simplification to narrow it down. I finally got down to:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> <br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Search string: (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+([0-9])[\s\,]+</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">
Replacement string:
\1\s0\2\s</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> <br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">The new search works fine (as did some of the previous
stepwise simplified ones), but the replacements are baffling me.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">The line<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">From AncientBBS1 Thu Jan 2, 1986 20:50:00</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">gets changed to<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">From AncientBBS1 Thu 02 1986 20:50:00</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> <br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">I.e., the variable \1 seems to get lost. In my previous stepwise simplified cases, multiple variables got lost when the search worked at all.<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> <br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Why am I doing this? I need to massage some old BBS messages into the retarded mbox format, whose date format (on the "From " line) of "Tue Nov 05 19:02:00 1985" is particularly illogical. Be that as it may, The two sources of these messages I am processing had further sloppiness in their dates, done by some ancient BBS bozos. I did successfully fix a lot of that already with regex.<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> <br></div><span style="font-family:verdana,sans-serif"><font size="2">Hartmut W Sager - Tel +1-204-339-8331</font></span><br><span style="font-family:verdana,sans-serif"></span><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.ca" target="_blank">Roundtable@muug.ca</a><br>
<a href="https://muug.ca/mailman/listinfo/roundtable" rel="noreferrer" target="_blank">https://muug.ca/mailman/listinfo/roundtable</a><br>
</blockquote></div>