This is VERY easy to do because the "gcode" page, https://duet3d.dozuki.com/Wiki/Gcode, has section tags in it that contain the G or M codes, and certain keywords that are useful for searches.
Here are some pieces of implementing this. I am putting them here because I tested them in a console debugger and I don't want to lose them.
Place a copy of
https://duet3d.dozuki.com/Wiki/Gcode.html on the SD card in /www.
This is necessary because the browser will not let Javascript fetch web pages from "across domains". DWC will be running from the "domain" of your local printer. It won't fetch dozuki.com pages. This is a security thing.
This implies that update releases of DWC would need to include refreshes of this page, copied from the dozuki.
Add a field for the user to type "G1" or "Move" or whatever word they want to search. Probably on the console page (so as not to further clutter the main page).
Fetch the Gcode page into a variable, with regular old Java script.
var r = new XMLHttpRequest();
r.open('GET', '/Gcode.html', false);
r.send(null);
nextstring = r.responsetext;
Run a loop, searching via a regular expression (I tested the regex repeatability; i did not test a loop):
sregex = /(.*?)("#Section_(?:(?!#Section_).)*?**what the user entered**.*?")(.*)/g;
#loop of some sort
sresult = sregex.exec(nextstring)
nextstring = sresult[3]
link = sresult[2]
# Note: need to accumulate the links, and display them to the user.
link = "//https://duet3d.dozuki.com/Wiki/Gcode" + link.substring(0,link.length - 1); # Remove trailing quote
if (nextstring == "" ) break;
# end of loop
Present results to user as links.
That's it!