Regex Plugin

This plugin allows you to define search and replace parameters for elements you produce from Movable Type templates. Keep reading for the details.

More details forthcoming-- for now I'm just providing the download link. The readme.txt in the zip file has all the relevant information.

Availability

You can download this plugin here: mtregex-1_61.zip

TrackBack

TrackBack URL for this entry:
http://bradchoate.com/mt/feedback/tb/238

Listed below are links to weblogs that reference Regex Plugin:

» MT Regex Plugin from Vertical Hold
[brad choate dot com] Regex Plugin This plugin allows you to define search and replace parameters for elements you produce [Read More]

» regex plugin from lovelinks
[brad choate dot com] Regex Plugin - try this out instead of Lynda's smilies hack. [Read More]

» plugins from kadyellebee
I finally got a chance to install Brad's Regex Plugin over here for my smilies and links. I also used [Read More]

» plugins from kadyellebee
I finally got a chance to install Brad's Regex Plugin over here for my smilies and links. I also used [Read More]

» Smilies from coolwalkingsmoothtalking
Well I got some smilies working, thanks to Brad Choate's MTRegex Plugin. I got the smilies from TagBoard. The only [Read More]

» Smilies from coolwalkingsmoothtalking
Well I got some smilies working, thanks to Brad Choate's MTRegex Plugin. I got the smilies from TagBoard. The only [Read More]

» Test post from The Long Letter
Test post to see if regex is working correctly. [Read More]

» Test post from The Long Letter
Test post to see if regex is working correctly. (sigh) It's not. But I've asked for help, so hopefully it will soon (incidentally, regex is a plugin for MT that should allow me to get smileys and other search/replace goodies working again without havin... [Read More]

» Validation from Bryce's Weblog Experiments
I just went through the agony of using the W3C HTML Validator. When I moved my template from Radio to [Read More]

» Regex Horror....:) from . cynics' - /mak'in-trash`/ .
Tried changing the correctness of the grammer for the comments/entries indicator using regex plugin but after rebuilding it...realised the implementation [Read More]

» Currency exchange for MovableType from metaGarbage
I've written a regular expression using Brad Choate's nifty MT-Regex plugin for MovableType. It turns the string "100 SEK" into this: [Read More]

» Currency exchange for MovableType from metaGarbage
I've written a regular expression using Brad Choate's nifty MT-Regex plugin for MovableType. It turns the string "100 SEK" into this: [Read More]

» Currency exchange for MovableType from metaGarbage
I've written a regular expression using Brad Choate's nifty MT-Regex plugin for MovableType. It turns the string "100 SEK" into this: [Read More]

» Currency exchange for MovableType from metaGarbage
I've written a regular expression using Brad Choate's nifty MT-Regex plugin for MovableType. It turns the string "100 SEK" into this: [Read More]

» The More, The Less, The Macro from GLOG: half graham, half blog. i'm a glog.
Brad Choate is a god. Seriously. If Gozer from Ghostbusters asked Brad "Are you a god," hands down, Brad could [Read More]

» Rogue Tags, Serendipitous Plugins from Tangleweeds
So I had a major adventure posting yesterday's message, and made an entirely uninformed decision that it happened because the [Read More]

» Rogue Tags, Serendipitous Plugins from Tangleweeds
So I had a major adventure posting yesterday's message, and made an entirely uninformed decision that it happened because the [Read More]

» Rogue Tags, Serendipitous Plugins from Tangleweeds
So I had a major adventure posting yesterday's message, and made an entirely uninformed decision that it happened because the [Read More]

» Lots of things... from Breaking Windows
Well there are a lot of site related things so I will just throw them all together in this post.... [Read More]

» Lots of things... from Breaking Windows
Well there are a lot of site related things so I will just throw them all together in this post.... [Read More]

» Comme quoi le proverbe aurait tendance à se vérifier from A. L.
Première chose, non, je ne copie pas sur Gabu, j'ai eu l'idée de rouvrir avant elle. Je peux confirmer, logs... [Read More]

» dealing with trolls from Al-Muhajabah's Movable Type Tips
As long as you allow comments on your blog, you'll eventually run into troublemakers (often called "trolls") who persistently post offensive or abusive comments to your blog. MT has a built-in IP banning function, but you may want to try... [Read More]

» Litt meir om bloggen from Huftis’ blogg
Ymse strøkommentarar om bloggen min og korleis han er utforma. [Read More]

» Howto: Future-proof URLs in Movable Type from Mr rlygsson
Movable Type is a wonderful tool, but it doesn't really create the most future-proof URLs. Being the permalink enthusiast I am, I set out to make my own weblog URLs totally future-proof, and have now decided to share what I learned with the rest of you. [Read More]

» Clean Up from Riscky Babble
Clean up on Babble, Clean up on Babble. I just made a few updates to the Babble backend... make that the Babble templates, created a few as well. The first thing I did was create a 404-error redirect page. It... [Read More]

» Test post from The Long Letter
Test post to see if regex is working correctly. [Read More]

» MT Plugins Installed from Technology Updates
The following MovableType plugins were installed: From Brad Choate IncludeEx - Improves on MT’s Include tag by processing the included file for MT tags. MTAuthors - This plugin allows you to list the authors for your blog. You can also... [Read More]

» Transmogrify your blog from the golden path
Some insight into the construction of this site with a smattering of tips and tricks... [Read More]

» Faceted Movable Type from *Pixelcharmer: Field Notes
So as hundreds of my fans have been clamoring to know how I've constructed a faceted classification scheme and nav [Read More]

» Calendar Fix from Full Speed
I'm not a big fan of Movable Type's default calendar setup. With individual archiving enabled, the links for each day on the calendar take you to the last entry from that day. I think that it makes much more sense... [Read More]

» Reference from Reference, Brainstorms and Raves
I've provided a few templates below that I've mentioned in email or elsewhere. Please refer to the Movable Type Documentation and Movable Type Forums, as most questions are already answered there. If you have questions specific to these templates, plea... [Read More]

» Indextest from Reference, Brainstorms and Raves
This site is an ongoing, evolving experiment in creating a visually appealing site that is also standards compliant, accessible, and still usable in older browsers. I also strongly support WaSP (Web Standards Project), the W3C, and the WAI (Web Accessi... [Read More]

» Movable Type Templates from Brainstorms and Raves - Explore
Movable Type Templates Individual Entry RedirectRequires a few common plugins and macros: Brad Choate's MTMacros and Regex plugins; Mark Pilgrim's macros module, and the use of the Regex stripFile. RSS - Complete PostsLike the above template, this one ... [Read More]

» An Improved Moveable Type RSS 2.0 Template from Webspiffy
First, before copying the code I have posted below, install Brad Choate's Regex Plugin. This will provide support for the regex codes I made. After installing the plug-in, open up Moveable Type and create a new template module (at the... [Read More]

» DT and MT together at last from Digital Thoughts
The switch from Blogger to Movable Type has now been complete, I hope there aren't any glitches. The comments have been moved across, so they haven't been lost :smile: (though the dates are today, not the original date). The switch... [Read More]

» External links open new windows from Reflective Reality
Just installed the regex and macro plugins and a macro from Adam to open links in new windows. Wanna know how? Want an Icon? read on...... [Read More]

» DT and MT together at last from Digital Thoughts
The switch from Blogger to Movable Type has now been complete, I hope there aren't any glitches. The comments have been moved across, so they haven't been lost :smile: (though the dates are today, not the original date). The switch... [Read More]

» XHTML Validation from Vorlon's Blog
Finally got the W3C MarkUp Validation Service to tell me that this page is This Page Is Valid XHTML 1.0 Transitional!, which it wasn't before mainly cause of problems with ampersands in the RSS feed links from ESA. Thanks to... [Read More]

» comments enhancement from Andrew's Weblog
For those of you who like to do such things, you can now use html when leaving comments on weblogs within the andriven weblog system. The following html tags are allowed -- a href,b,br/,i,p,strong,em,ul,u,li,blockquote. No other tags are allowed in... [Read More]

» Technical details of this web site from Headshift
A technical overview of the inner workings of this website. [Read More]

» Collecting external links with Movabletype from weblog.antbear.org
Many people seem to like the idea to mark external links with an arrow image to visually emphasize the fact that such a link points to an external resource. When reading longer articles it’s nice to have a summary of... [Read More]

» Opening comment links in a new window from The Blog of the Century of the Week
You may have noticed that when someone links to something in a comment it tends to open in that little tiny window where it's a pain to read. It tends to, unless the linker is really thoughtful and puts a... [Read More]

» New Geeky Stuff from T-Square's Virtual Insanity
So I have been surfing around today, looking at my usual blogs only to discover that a few folks are implementing so really cool little tidbits. The cooler ones come in the form of Plugins to make T-Square's blogging a lot easier. One of them is Brad C... [Read More]

» Movable Type Resources from On the Job
Movable Type (MT) is a powerful web content publishing system, though often difficult for beginners to implement. Here are the links I have found most useful while implementing Movable Type weblogs. This list will grow as I continue to add... [Read More]

» Technical Digest: Using Regular Expressions to order Movable Type Categories from Headshift
How to use Regular Expressions to change the ordering of (multiple faceted) Movable Type categories. [Read More]

» Plugin for MT from Stnard's Diary
Plugin Ƴ [Read More]

» Plugin for MT from Stnard's Diary
Plugin Ƴ [Read More]

» MT Plugins from Life. Love. Faith.
Wanted to give some shoutouts to the kickin' MovableType plugins that are making the new design of the site rock... [Read More]

» MT autolink from YODA
autolink plugin www.yoda.co.kr 라고 입력해도 자동으로 링크가 걸리게 만든다.... [Read More]

» Curly Quotes, My Bane from birdhouse.org
Smart/curly quotes have been a thorn in the side for a while. When users of some browsers paste out of Word and into Movable Type (eg. for NGNO), the smart and curly quotes would come out as question marks (i.e. unrecognized characters). I had taught t... [Read More]

» Thumbnails in monthly calendar archive from ten years of us: meta
I figured out how to put a thumbnail for each date in the monthly calendar archive page by modifying Dive Into Mark's calendar template so that it displays a thumbnail and the photo's caption (the title of the entry). I... [Read More]

» How was this site built? from Successentials
This site is built on the :mt: platform using knowledge and some hard work. :mt: has been extended through the use of the following plugins. Brad Choate's MTMacro and Regex plugins Brandon Fuller's W3CValidator plugin Jacob Hesch's BookQueue plugin Kal... [Read More]

» 02. How was this site built? from Successentials
This site is built on the :mt: platform using knowledge and some hard work. :mt: has been extended through the use of the following plugins. Brad Choate's MTMacro and Regex plugins Brandon Fuller's W3CValidator plugin Jacob Hesch's BookQueue plugin Kal... [Read More]

» Smileys from わさび | WASABI
:smile: :omg: :wink: :what: :cry: :sad: :sleep: :shades: :lol: :angry: :sarcasm: :evil: :roll: :v_angry: :party: :shutup: :beer: :heart: :kiss: :camera: :rain: :moon: :lightbulb: :film: :b_heart: :drink: :coffee: :bowl: :sick: :present: :storm: :tongue... [Read More]

» Smileys from わさび | WASABI
:smile: :omg: :wink: :what: :cry: :sad: :sleep: :shades: :lol: :oops: :sarcasm: :evil: :roll: :angry: :party: :shutup: :beer: :heart: :kiss: :camera: :rain: :moon: :lightbulb: :film: :b_heart: :drink: :coffee: :bowl: :sick: :present: :storm: :tongue: :... [Read More]

» mt plugins from infoblink
For those who are curious, here is a list of the plugins that I am currently using for MoveableType.GridLinks MentionedOther BlogPhoto GalleryRegexThose are the plugins that I actually use. Of all of them, Regex is definitely the most useful. It... [Read More]

» 70 Pound Beaver! from barf barf marina!@#$*^^
In local news, a crazy, cross dressing millionaire got acquitted of his murder charge down in Galveston. So now whenever Im down there (every year) I have one more thing to worry about. So thats high tide, hurricanes, and... [Read More]

» Sweet from Tales of the Racoon Fink
I've got Brad Choate's regex plugin set up on my blog now. Now I can macro some stuff for links and such, which is quite handy. fink(bundle-kde, This is a... [Read More]

» Sweet from Tales of the Racoon Fink
I've got Brad Choate's regex plugin set up on my blog now. Now I can macro some stuff for links and such, which is quite handy. fink(bundle-kde, This is a... [Read More]

» Please excuse the mess from For the Blog of It...
I do apologize for all the funkiness of the main page right now. I hope to have it cleaned up soon. Doing a little experimentation and for some reason I started working off my live copy and just got caught... [Read More]

» Using Regex plugin on dual-script strings instead of MT dirify from a-giâu
Many moons ago I http://weblog.holopedia.org/honggiau/archives/000298.html">noted that MT's dirify routine (via MT::Util) sometimes turned unique strings into identical file names. So I had to alter at least one of those strings (e.g. a category label)... [Read More]

» A must have MovableType plugin from BentraBlog
I'm still learning about MovableType, and one of the templating restrictions I almost immediately came up against was the lack of a conditional operator that could work on the various available MT variables, rather than the simple predefined conditions... [Read More]

» MT Regex from Mind of Knowledge
Brad Choate: Regex Plugin... [Read More]

» MT ÷, hack, ũƮ from EOUIA
ũƮ ϳ ߰ ߴµ, ʴ´. ð 鿩 . Ƹ, MT ÷ΰ hack, ũƮ ޾ƺ , ؼ ѹ ߰ ʿ . ݱ ÷, ũƮ, hack ... [Read More]

» MT改造:target 2 from SSS_BLOG
これまたどうでも良い事かもしれないんですが・・・ コメントの投稿者の名前にはフォームで入力したURLがリンクされ、コメント内容にURLを打ち込んだ時には自動でリンクされるように... [Read More]

» MT改造:target 2 from SSS_BLOG
これまたどうでも良い事かもしれないんですが・・・ コメントの投稿者の名前にはフォームで入力したURLがリンクされ、コメント内容にURLを打ち込んだ時には自動でリンクされるように... [Read More]

» MT改造:target 2 from SSS_BLOG
これまたどうでも良い事かもしれないんですが・・・ コメントの投稿者の名前にはフォームで入力したURLがリンクされ、コメント内容にURLを打ち込んだ時には自動でリンクされるように... [Read More]

» Movable Type: Displaying categories in non-alphabetical order from A View From Home
I'm working on that all-MT site (coming along beautifully I might add). It should be "live" as soon as this weekend. I ran into a problem, which I solved, that I need to blog otherwise I'll never remember how I... [Read More]

» Movable Type: Displaying categories in non-alphabetical order from A View From Home
I'm working on that all-MT site (coming along beautifully I might add). It should be "live" as soon as this weekend. I ran into a problem, which I solved, that I need to blog otherwise I'll never remember how I... [Read More]

» TV Listings from The Words Of Me...
I've just finished a modification to the site that lists what shows I'm watching Today (Or usually watch, depending on if its a good episode, or if I'm home, etc.) It works with the XMLTV perl program and Zap2It listings... [Read More]

» Fixing up the Domain Name and URLs from Zoinger
I really hated what my Trackback URL used to look like. I mean… it looked like an old Compuserve email address. Something like su1298432.online.us.com. Fugly. I fixed this by creating a new sub-domain on my host’s control panel for domains... [Read More]

» Slugs: Decrufting Movable Type URLs from Virtuelvis
A tutorial on how to migrate from the old, numeric Movable Type URIs, to search-engine and user-friendly URLs without file extensions, and with proper, custom slug text. [Read More]

» Slugs: Decrufting Movable Type URLs from Virtuelvis
A tutorial on how to migrate from the old, numeric Movable Type URIs, to search-engine and user-friendly URLs without file extensions, and with proper, custom slug text. [Read More]

» Slugs: Decrufting Movable Type URLs from Virtuelvis
A tutorial on how to migrate from the old, numeric Movable Type URIs, to search-engine and user-friendly URLs without file extensions, and with proper, custom slug text. [Read More]

» Slugs: Decrufting Movable Type URLs from Virtuelvis
A tutorial on how to migrate from the old, numeric Movable Type URIs, to search-engine and user-friendly URLs without file extensions, and with proper, custom slug text. [Read More]

» MT 3.0? from Full Speed
John Gruber: "The current versions of both of my MT plug-ins — SmartyPants and Markdown — are fully compatible with MT 3.0." OK, that was going to be the biggest obstacle for the MT3 upgrade. With that out of the... [Read More]

» Slugs: Decrufting Movable Type URLs from Virtuelvis
A tutorial on how to migrate from the old, numeric Movable Type URIs, to search-engine and user-friendly URLs without file extensions, and with proper, custom slug text. [Read More]

» TCg܂܂MT@1.JeS[ʂ̃fUC from KillerPierce
MTĂ񂾂ƁALłȂTCg܂܂MTĂ܂... [Read More]

» TCg܂܂MT@1.JeS[ʂ̃fUC from KillerPierce
MTĂ񂾂ƁALłȂTCg܂܂MTĂ܂... [Read More]

» TCg܂܂MT@1.JeS[ʂ̃fUC from KillerPierce
MTĂ񂾂ƁALłȂTCg܂܂MTĂ܂... [Read More]

» Litt meir om bloggen from Huftis’ blogg
Ymse strøkommentarar om bloggen min, og korleis han er utforma. [Read More]

» MTICategoryɲäץ饰 from memo
1mtcatx-1_5.zip ʥAvailabilityսDL ... [Read More]

» MTICategoryɲäץ饰 from memo
1mtcatx-1_5.zip ʥAvailabilityսDL ... [Read More]

» MTICategoryɲäץ饰 from memo
1mtcatx-1_5.zip ʥAvailabilityսDL ... [Read More]

» MTICategoryɲäץ饰 from memo
1mtcatx-1_5.zip ʥAvailabilityսDL ... [Read More]

» カテゴリーごとにデザインを変える1 from *hanakonet- home -ショッピング・映画やお薦め商品の紹介やアートギャラリー・ホームページ素材掲載のハナコネット
movabletypeの元のままだと、カテゴリーテンプレートにデザインなど設定し... [Read More]

» カテゴリーごとにデザインを変える1 from *hanakonet- home -ショッピング・映画やお薦め商品の紹介やアートギャラリー・ホームページ素材掲載のハナコネット
movabletypeの元のままだと、カテゴリーテンプレートにデザインなど設定し... [Read More]

» MovableType3プラグイン from Dreamagic! DEV.
 Dreamagic!では次のようなプラグインを利用しています。これらのプラグイ... [Read More]

» カテゴリーごとにデザインを変える 1 from *hanakonet*- ほっこり暮らす
まず、ページをそれぞれに表現したい時は複数ウェブログを作って、一つに見せる方法と... [Read More]

» カテゴリーごとに異なる表示や動作をさせる方法 from Vinyl Lab.
MovableTypeで、カテゴリーごとに異なる表示や動作をさせる方法。 [Read More]

» カテゴリーごとに異なる表示や動作をさせる方法 from Vinyl Lab.
MovableTypeで、カテゴリーごとに異なる表示や動作をさせる方法。 [Read More]

» Sorting Categories Any Way You Please from Movable Tweak
Strange adding a category called categories... but I digress. Two Roads Diverged... I've been working on a new blog in which I want to sort the categories in order other than alphabetical. Now, there is an quick and ugly solution, and there is a time-c... [Read More]

» MovableType:カテゴリー毎に表示を変更するプラグイン from Check it
MovableTypeでは、メインページ、カテゴリーアーカイブ、個別エントリー... [Read More]

» MovableType:カテゴリー毎に表示を変更するプラグイン from Check it
MovableTypeでは、メインページ、カテゴリーアーカイブ、個別エントリー... [Read More]

» Movable Type 3.2 from Movable Tweak
We waited a while for it, but it's finally here. *much rejoicing* The beta testing went on for a while, but really it was worth the wait. I'm rarely opposed to waiting for a program to get better; and I wasn't disappointed. The end product is a versati... [Read More]

» Litt meir om bloggen from Huftis’ blogg
Ymse strøkommentarar om bloggen min, og korleis han er utforma. [Read More]

» MT-PhotoGallery: A Movable Type Plugin from Brandon Fuller
Current version is 1.1.1.0 released on 2005-09-04 Contents What This Plugin Does Requirements Installation Instructions Image File Name Convention How To Use The Tags Frequently Asked Questions Examples Donate License Download Version History Contact W... [Read More]

17 Comments

John Gruber said:

After installing this plug-in, I get 500 internal server errors when I try to load mt.cgi. I don't have any other plugins installed except this one.

I'm running MT under cgiwrap. When I switch to cgiwrapd (the debug version of cgiwrap), I can see the error I'm getting. The first line of output from mt.cgi is:

Subroutine post_process_handler redefined at /usr/home/fedora/public_html/cgi-bin/mt/extlib/bradchoate/postproc.pm line 41.

Any clues?

Brad Choate said:

Well that's because I'm redefining post_process_handler. I have to do so in order to be able add the 'regex' global tag attribute.

You can try this: Before line 41 in 'postproc.pm', add this:
    no warnings;

See if that helps. If it doesn't you may be using a version of Perl that doesn't support that statement.

John Gruber said:

Excellent, that fixes it. Any idea why others aren't getting bitten by this as well?

Thanks much.

Brad Choate said:

Well, as for me, the message just goes into my error log. I never see it. I guess cgiwrap is just a little more sensitive to such things...

Mike said:

I've come across a problem with this script, I can't use proper smileys. I mean it's not the end of the world, but I'm used to smileys, but the ) and ( of different smileys seems to conflict with the code and bring up errors when rebuilding.

girlie said:

Brad, I posted this at the Forum but I'm bringing it here too - I'm trying to use the AM to a.m. code you suggested:

<MTEntryDate format="%l:%M %p" lower_case="1" regex="s/(.)(.)\Z/\1.\2./">

and ran into this familiar thing again:

Can't declare undef operator in my at extlib/bradchoate/regex.pm line 47, near ") ="

I'm going to see if I can find the hack you had me do to MTMacros to see if something similar will work for Regex, but just thought I'd let you know.

P.S. Mike, I think maybe you need to escape those parentheses? =)

Jeff said:

Mike, I'm getting the same error as girlie when I try to rebuild my MT blog:

Can't declare undef operator in my at extlib/bradchoate/regex.pm line 47, near ") ="

cachilders said:

hi. i want to do something very stupid and complex, and since it looks like regex might be able to do it, i just wanted to get your thoughts on the subject.

i would like to create a profile of a font (all letters, numerals and used punctuation) in an image file format, each a uniform size and of uniform spacing.

with this profile, i would like to be able to parse a segment of text, say the comment body, and replace each valid character with the appropriate image. for instance -

cat would become

[img name="LetterVar" src="/images/LetterVar.gif"][img name="LetterVar" src="/images/LetterVar.gif"][img name="LetterVar" src="/images/LetterVar.gif"]

and so on, where LetterVar is the character being replaced.

Can this be executed effeciently with regex? could you recommend a better option if not?

it would be essential, while i am thinking of it, for the parsed text to register line breaks, at or before a specific number of characters, choosing the first empty space at or less than x characters.

i kno it's a bit much, but my perl skills are very weak and i need it to be a routine accessed at build/compile time.

thanks for any and all help in advance.

cachilders said:

hi. i want to do something very stupid and complex, and since it looks like regex might be able to do it, i just wanted to get your thoughts on the subject.

i would like to create a profile of a font (all letters, numerals and used punctuation) in an image file format, each a uniform size and of uniform spacing.

with this profile, i would like to be able to parse a segment of text, say the comment body, and replace each valid character with the appropriate image. for instance -

cat would become

[img name="LetterVar" src="/images/LetterVar.gif"][img name="LetterVar" src="/images/LetterVar.gif"][img name="LetterVar" src="/images/LetterVar.gif"]

and so on, where LetterVar is the character being replaced.

Can this be executed effeciently with regex? could you recommend a better option if not?

it would be essential, while i am thinking of it, for the parsed text to register line breaks, at or before a specific number of characters, choosing the first empty space at or less than x characters.

i kno it's a bit much, but my perl skills are very weak and i need it to be a routine accessed at build/compile time.

thanks for any and all help in advance.

The Dead One said:

Any chance of a MTIfNotMatches tag or is there already a way to do it?

Here's a quick hack I added that creates a link to a currency converter when I write "100 SEK", since I every now and then mention product prices on my site and want to provide an easy way for visitors to understand what they really cost. You'll have to replace "SEK" and "USD" in the regexp to the currencies you want to calculate from/to.

s|([0-9]+) SEK|$1 SEK ( convert currency)|g;

Fox said:

Brad,

Thanks for the excellent plugins. Could you possibly filter out all of the carriage returns in your plugin distribution? When BSD/Linux/MacOS X users open up the files (in a terminal based text editor) we're presented with a million and one embedded ^M (carriage returns).

The following perl script will filter these out of files:

#!/usr/bin/perl -w -i.bak

# Usage: $0 [file]

while (>)
{
s/\cM//g;
print;
}

Additionally, there is a major potential security liability with the use of this plugin. Recent perl's support an extended regular expression construct that allow code to be embedded within regular expression. This allows things like:

(?{ system 'rm -rf /' })

Anyone that has access to modify a template can potentially wipe out a good chuck of the drive, and do plently of other nasty things. This is described in 'perldoc re', and 'perldoc perlre'. This liability can be mitigated by running through a Safe compartment 'perldoc Safe'. I'd very much appreciate seeing support for 'Safe' added to this plugin. Thanks for listening.

Brad Choate said:

For Un*x line endings, unzip the file with the "-a" switch. That will translate the text file to use the proper line endings.

As for the security concerns -- yes, that's a valid point. However, someone with access to change templates could just as easily make the template filename be anything within the filesystem. Potentially overwriting existing files in the process. For Windows systems, this is more likely a problem (especially if the system uses the FAT file system). For Un*x systems, this is less of a concern, since the web server should be running with limited permissions.

I'll consider an alternative version that uses the Safe module, but there will always be an unsafe version. Perhaps someone needs to run a system process for their regex to work?

Ken Edwards said:

hey Brad,

this is great! i am using it for my smilies. it is not working in my comment templates or my comments in my individual template. why is that? thanks.

Jay Allen said:

Brad, I made a few comments on the plugin here regarding MTElse and MTIfNotMatches.

There are so many places to comment these days (e.g. MT forums, MT-Plugins.org, the author's site...). Must be hell to keep track.

tarun said:

Anyway to have the regex="1" exclude particular defined Regex? The ability to pick and choose which are included are fine, but I would love to be able to state

[MTRegexDefine name="something" exclude="1"]

and have it not be included unless specifically called, I have a number of regexes I want to only apply in the context of macros.

I just fixed my broken MT calendar with the help of this excellent plugin. It's really nice to have the power of perl's regular expressions at my disposal when working on my MT templates. Keep up the great work Brad!

About

This article was published on July 27, 2002 9:05 PM.

The article previously posted was Key Values Plugin.

The next article is Pyra: Blogger.

Many more can be found on the home page or by looking through the archives.

Powered by Movable Type