We Recommend

Mastering Regular Expressions Mastering Regular Expressions
As this book shows, a command of regular expressions is an invaluable skill. Regular expressions allow you to code complex and subtle text processing that you never imagined could be automated. Regular expressions can save you time and aggravation. They can be used to craft elegant solutions to a wide range of problems. Once you've mastered regular expressions, they'll become an invaluable part of your toolkit. You will wonder how you ever got by without them.


Posted By

mikegreen on 07/05/08


Tagged

regex css javascript ruby


Versions (?)


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.