Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Eddie

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Create an regexp (Regular expression) from an array of Strings

// description of your code here
Create a DNF regular expression from an array of strings even if they have special characters.

Regexp.new(array.collect{|string| Regexp.escape(string)}.join("|"))
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS