Skip to main content.
home | support | download

Back to List Archive

RE: regex help :0)

From: stuart <stuart(at)>
Date: Fri May 08 1998 - 11:53:14 GMT
Thanks to all of you who took the time to help me with my regex
problem!(recap: how to add "field=" to a list of search words while
skipping all booleans)

FYI, I saw many different approaches to the problem but the one I like
best is this sweet one liner(Perl):


Here it is in practice
>:r! echo andy and cor or ignore nor luthor | perl -wpe \
>        's/(\b(?!and\b|n?or\b)\S+(?:\s|$))/field=$1/g'
>field=andy and field=cor or field=ignore nor field=luthor
>The hip owls book should help you understand *what* I did and why. :^)

Thanks Elijah.

BTW, the "regex bible" I mentioned is Mastering Regular Expressions by
Jeffrey E. F. Friedl which can be had at:

for $23.96. The reviews convinced me to let my employer buy it for me
:o)  .

Received on Fri May 8 04:54:45 1998