[net.emacs] Question about regular expression searches

crl@CSvax:Pucc-H:pur-phy.UUCP (07/29/83)

I have run into a possible bug in regular expression searches.  Perhaps
it isn't really a bug, but just a feature of the way it works.  If I
say (re-search-forward "^") and repeat this a number of times, I would
expect to successively find the beginning of the next number of lines.
However, what happens is that I find the first beginning of line, and
not move from there.  Is this supposed to be the correct behavior?
I sometimes would like to use (re-query-replace-string "^" "/* ") for 
example to sometimes comment out some C code.  However, if I don't change
an occurrence, I'm stuck there.  I am therefore forced to use
(re-query-replace-string "^." "/* &") which has the (sometimes) unfortunate
side-effect of not finding a blank line.  Looking into the source, most of
the regular expression code in advance() behaves like this for the 
characters like '^', '$', etc.  Comments?

Charles LaBrec
pur-ee!Physics:crl
purdue!Physics:crl

chris@umcp-cs.UUCP (08/02/83)

The fix to the ``can't answer no'' problem in re-query-replaces for
"^", "$", or "^$" is:

search.c.old:
		case 'n':
		case '\177':
		case Ctl ('G'):
		    break;

search.c:
		case 'n':
		case '\177':
+		    if (global.loc1 == global.loc2)
+			DotRight (1);
		case Ctl ('G'):
		    break;

(This is in PerformReplace() in search.c, near line 313.  If you're
using U of MD Emacs "global" is called "search_globals".)

				- Chris
-- 
In-Real-Life:	Chris Torek, Univ of MD Comp Sci
UUCP:		{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:		chris@umcp-cs
ARPA:		chris.umcp-cs@UDel-Relay

thomas@utah-gr.UUCP (Spencer W. Thomas) (08/03/83)

If you have the UniPress emacs (#264), global is called ThisSearch.

=Spencer