Archive for the ‘RegEx’ Category

RegEx: Match filename with extension

Wednesday, March 7th, 2012

Checking if it is a image file

([^s]+(.(?i)(jpg|png|gif|bmp))$)

Very good explanation of this regex here

RegEx: Get number and unit from a css property string in JavaScript

Monday, April 4th, 2011
var numeric = "12px".match(/d+/);
var unit = "12px".match(/D+$/);

Source: stackoverflow: convert css units

RegEx: Selecting html tag content

Wednesday, September 23rd, 2009

RegEx to select the content of div.code

<divb class=.code[^>]*>([sS]*?)</div>

Result:

<div class="cdeBlock">
<div class="cdeLbl">HTML: /snowReport?resort=Tahoe</div>
<div class="code html"><p>Hello, there are ${m.newSnowInch} inches
 of new Snow in ${r.p.resort} </p></div>
</div>

<div class="cdeBlock">

RegEx: Upper Case or Camel Case Selector

Monday, April 13th, 2009

RegEx to select all the caps and numbers

([A-Z]|(d*d))

Result:

Camel With23Some Numbers56

RegEx: Java Quick Start and Tips

Wednesday, April 8th, 2009

RegEx: Best RegEx Eclipse Plugin QuickRex

Wednesday, November 12th, 2008