# How to use regex with if\_url tag!

**URL:** <https://www.ruby-forum.com/t/how-to-use-regex-with-if-url-tag/136613>\
**Category:** Radiant CMS\
**Created:** [May 4, 2008, 2:53pm UTC](https://www.ruby-forum.com/t/how-to-use-regex-with-if-url-tag/136613 "2008-05-04T14:53:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![imakethings](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ce7236/32.png) [@imakethings](https://www.ruby-forum.com/u/imakethings)\
**Post date:** [May 4, 2008, 2:53pm UTC](https://www.ruby-forum.com/t/how-to-use-regex-with-if-url-tag/136613/1 "2008-05-04T14:53:08Z")

</div>

\<r:if\_url matches="^._\b(podcast|podcasts|audio|media)\b._$"\>

### some reference to an audio file here

\</r:if\_url\>

Essentially what the regular expression above does is show the content  
only if the url contains any of the following words. So in the example  
if I’m running a podcast (using page\_attachments to upload audio files)  
I can show the audio url ONLY within the context of the url keywords  
described in the regexp and you can add as many keywords as you’d like.

---

<div class="post-metadata">

**Author:** ![imakethings](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ce7236/32.png) [@imakethings](https://www.ruby-forum.com/u/imakethings)\
**Post date:** [May 4, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/how-to-use-regex-with-if-url-tag/136613/2 "2008-05-04T17:24:00Z")

</div>

Arik,

Nice tip! You can do some pretty powerful things with \<r:if\_url\> and  
regexps.

Sean
