Part of Nobumi Iyanaga's website. n-iyanag@ppp.bekkoame.or.jp. 8/2/98.

logo picture

MgrepExtra

version 1.0.1b2
Nobumi Iyanaga
02/08/98
Mac only: Frontier version 4.2.3 and higher

Mgrep is an OSAX written by Hideaki Iimori, an implementation of "grep find": it has only one command "mgrep do", to find strings with grep expressions. The latest version, 1.5b2, has many good features, such as the ignore case option, whole word option, or the support of some new grep expressions. It has also an important feature which is not in any of other grep OSAX or UCMD: it is WorldScript aware, so that you can use it with any of the languages supported by Apple's WorldScript I and II (hence it's name "Multibyte aware GREP"), as long as you have installed in your System the appropriate language kit. Finally, it is currently the only grep alternative that can be used with Frontier 5.0.1 (Mac version).

You can find the latest version of Mgrep OSAX at:

http://www.bekkoame.ne.jp/~iimori/sw/mgrepOSAX.html


mgrepExtra (39K to download) is a set of scripts which make easy the use of mgrep.

There are some basic scripts:

mgrepExtra.extract (s, pat, scriptCode = - 1, max = infinity, ignoreCase = false, returnSubstr = false)
mgrepExtra.match (s, pat, scriptCode = - 1, ignoreCase = false, returnStr = false, substrDelimiter = "")
mgrepExtra.subst (s, pat, subs, scriptCode = -1, ignoreCase = false, max = infinity)
mgrepExtra.substr (s, pat, scriptCode = - 1, ignoreCase = false)

Some other scripts have more specific purposes:

grep (pat, aList, trueOrFalse = true, scriptCode = -1, ignoreCase = false)

split (s, pat, scriptCode = -1, ignoreCase = false)
splitInParenthesisPat (str, parenthesisPat, scriptCode = -1, ignoreCase = false)

ifAll (s, pat, scriptCode = -1, ignoreCase = false)
ifContains (s, pat, scriptCode = -1, ignoreCase = false)

lastOffset (str, pat, scriptCode = -1, ignoreCase = false)

matchMultiParenthesis (str, parenthesisPat, indexList, scriptCode = -1, ignoreCase = false)
matchMultiParenthesisAll (str, parenthesisPat, indexList, scriptCode = -1, ignoreCase = false)

matchParenthesis (str, parenthesisPat, index, scriptCode = -1, ignoreCase = false)
matchParenthesisAll (str, parenthesisPat, index, scriptCode = -1, ignoreCase = false)

startEndOffsetAll (s, pat, scriptCode = 1, ignoreCase = false)

visitAllMatchAndReplace (str, pat, callBack, scriptCode = -1, ignoreCase = false, booleanTest = false, returnNonChanged = false)

The following two scripts simulate two important features of html.processMacros:

expandGlossary (str, delimiterA, delimiterB)
processMacros (str, delimiterA, delimiterB)

There is a table named "htmlGoodies" containing some scripts borrowed (and modified) from tagExtractionKit written by A. V. Lesikar:

htmlGoodies.getDirectiveList (str, isOutline=false)
htmlGoodies.getDirectiveValue (str, name, isOutline=false)
htmlGoodies.getImageList (str)
htmlGoodies.getLinkList (str)
htmlGoodies.getUrlList (tagList)
htmlGoodies.getUrlTagList (str)
htmlGoodies.stripDirectives (str, isOutline=false)
htmlGoodies.stripTags (str)

I added in this version a table named "mlstring" ("ml" stands for "multilingual") containing some string manipulation scripts which can be used for double byte strings:

mlstring.firstWord (s, scriptCode = -1)
mlstring.insert (source, dest, index, count = 0, scriptCode = -1)
mlstring.lastWord (s, scriptCode = -1)
mlstring.length (s, scriptCode = -1)
mlstring.mid (s, index, count, scriptCode = -1)
mlstring.nthChar (str, index, scriptCode = -1)
mlstring.nthWord (s, index, scriptCode = -1)
mlstring.popLeading (s, toPop, scriptCode = -1)
mlstring.popTrailing (s, toPop, scriptCode = -1)

Warning:
All these scripts are NOT tested extensively. Please use them with caution!!

And if you find bugs, please write me, so that I can fix them.

My e-mail address is:
n-iyanag@ppp.bekkoame.or.jp

This suite can be found at:
http://www.bekkoame.or.jp/~n-iyanag/Frontier/mgrepExtra.html

Enjoy!


In the version 1.0.1b2, I corrected some errors in the *ReadMe*, and I added a new table at mgrepExtra.thesaurusSearch. This is a rough draft of a new functionality that can be added to mgrep OSAX using scripts. I would like to improve this table in the future.


Return to Frontier Main Page
Go to Home Page


Mail to Nobumi Iyanaga


frontierlogo picture

This page was last built with Frontier on a Macintosh on Sun, Aug 2, 1998 at 18:08:25. Thanks for checking it out! Nobumi Iyanaga