# Replacing Text With Regular Expressions

**URL:** https://forum.highend3d.com/t/replacing-text-with-regular-expressions/2413
**Category:** Maya
**Tags:** mel
**Created:** [March 1, 2007, 5:15am UTC](https://forum.highend3d.com/t/replacing-text-with-regular-expressions/2413 "2007-03-01T05:15:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![daniel-faust](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@daniel-faust](https://forum.highend3d.com/u/daniel-faust)
#### Post date: [March 1, 2007, 5:15am UTC](https://forum.highend3d.com/t/replacing-text-with-regular-expressions/2413/1 "2007-03-01T05:15:34Z")

</div>

My goal is to archive the following transformation in 5 steps, and I want to know if it is possible to do this in mel or if I need to build a MPxCommand which uses PCRE (or would you recommend some other approach than PCRE?):

1. ((step & sand) | wind) & (and | or)
2. ((step & sand) | wind) & (🅰 | ![](http://www.highend3d.com/boards/style_emoticons/<#EMO_DIR#>/ohmy.gif)🙂
3. ((step and sand) or wind) and (🅰 or ![](http://www.highend3d.com/boards/style_emoticons/<#EMO_DIR#>/ohmy.gif)🙂
4. (((file like '%step%') and (file like '%sand%')) or (file like '%wind%')) and ((file like '%🅰%') or (file like '% ![](http://www.highend3d.com/boards/style_emoticons/<#EMO_DIR#>/ohmy.gif):%'))
5. (((file like '%step%') and (file like '%sand%')) or (file like '%wind%')) and ((file like '%and%') or (file like '%or%'))  
admittedly, the last step is trivial.

Daniel

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [March 1, 2007, 12:02pm UTC](https://forum.highend3d.com/t/replacing-text-with-regular-expressions/2413/2 "2007-03-01T12:02:49Z")

</div>

Maya has a PCRE like regexp subster yes, its a bit of subset but its there (and the more robust version isn't in the docs)

if all esle fails use python

basically you want to use

substitute "string" "s/str/ummmm/"
