# Regular Expression are file based

**URL:** <https://www.finalbuilder.com/forums/t/regular-expression-are-file-based/3345>\
**Category:** Bugs\
**Created:** [March 16, 2011, 12:59pm UTC](https://www.finalbuilder.com/forums/t/regular-expression-are-file-based/3345 "2011-03-16T12:59:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)\
**Post date:** [March 16, 2011, 12:59pm UTC](https://www.finalbuilder.com/forums/t/regular-expression-are-file-based/3345/1 "2011-03-16T12:59:06Z")

</div>

Hi!

I'm putting this as a bug, although I'll admit you can also view it as an enhancement request. (But at least you should put this into the docs.)

When using the Text Find/Replace Action, the regular expression used are _line based_, that is, I can neither match nor replace multi-line strings.

For example, given a file with this content:

> a  
> b  
> c  
> d

And a regexp search string of .+, I would expect to have exactly one match, but I'll have 4 matches - one for each line. Likewise, if I&nbsp;replace .+, each line will be replaced instead of the whole file.

I needed this to clear out empty lines from a text file. Using non-filebased regexp, I could replace all ^$ with the empty string to clear all empty lines (or some-such, I guess I'll have to play around with the exact pattern), but this is not possible with the Text Find/replace Action In Finalbuilder.

Thanks for considering this.

---

<div class="post-metadata">

**Author:** ![stephen.ryan](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@stephen.ryan](https://www.finalbuilder.com/forums/u/stephen.ryan)\
**Post date:** [March 17, 2011, 7:09am UTC](https://www.finalbuilder.com/forums/t/regular-expression-are-file-based/3345/2 "2011-03-17T07:09:25Z")

</div>

Hi Martin   
  
 I see your point about the need for adding a option to evaluate the source text in ‘Single Line’ mode. I will look at adding an option for this.   
  
 As far as replacing empty lines within a file, you can do this using the following expression:   
  
 [code]^\s\*(\r\n|\r|\n) [/code]   
  
 Just leave the replacement value empty and this will remove empty lines from the file.   
  
 Regards,   
 Steve
