Posted By

mikegreen on 07/05/08


Tagged

regex css javascript ruby


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

vali29
Tyster


Match CSS and JS Comments


 / Published in: Regular Expression
 

Matches CSS-style comments spanning one or multiple lines

  1. # This is how it would look using the Ruby Regexp class
  2.  
  3. # Only match one-line comments
  4. Regexp.new(/\/\*.*?\*\//)
  5.  
  6. # Match single and multi-line comments
  7. Regexp.new(/\/\*.*?\*\//m)

Report this snippet  

You need to login to post a comment.