1 2 3 4
// Check to make sure value is non-null and matches CSS grammar // A property may contain more than one class name so we need to // check each potential class name in the string. ...
1 2 3 4
# Initial attributes Hash # attributes = { ...
Ruby Ruby Hash Extraction Using ...
by notbrain.myopenid.com,
February 24, 2010 23:13,
7 refactorings, tagged with ruby, rails, regex, hash, block
I'm looking for a better wa...
1
$outputstr = preg_replace('/[-]{2,}/','-',trim(strtolower(str_replace(' ','-',preg_replace('/[^A-Z0-9- ]+/i','',$inputstr))),'-'));
PHP Trimming excess from string
by paulswansea.myopenid.com,
February 05, 2010 16:07,
4 refactorings, tagged with php, regex, replace
I'm trying to get an input ...
1 2 3 4
String className = file.getAbsolutePath(); /* TODO, replace this with regex is possible */ ...
Java replace with regex
Can this be refactored to u...
1 2 3 4
#!/usr/bin/perl use warnings; ...
Perl A Dvorak keyboard layout cy...
I can't quite get the last ...
1 2 3 4
class PropertyGroups def self.from_xml(xml) document = Document.new(xml) ...
Ruby Ruby text replacement done ...
The code is part of a libra...
1 2 3 4
def check_user_agent if api_access? regex = Regexp.new("^([^/[:space:]]*)(/([^[:space:]]*))?([[:space:]]*\[[a-zA-Z][a-zA-Z]\])?[[:space:]]*(\\((([^()]|(\\([^()]*\\)))*)\\))?[[:space:]]*") ...
Ruby warning: character class ha...
Hola guys.. I am somewhat l...
1 2 3 4
function formatCurrency(num) { num = num.toString().replace(/\\$|\\,/g,''); if (isNaN(num)) num = '0'; ...
JavaScript Format Currency
During a code review we fou...
1
category_id = category_name.scan(/category-(\d+)/)[0][0]
Ruby Ugly RegEx Accessor
I try to extract an id from...
1
/(?<part>(w(?!ww)|w(?=www)|w(?=[a-z0-9]+ww)|ww(?=[a-z0-9]+w)|www[a-z0-9]+|[a-vx-z0-9])[a-z0-9]*)\.example\.com/
Ruby Shortest regular expression...
I have written this regular...
1 2 3 4
/^(?:(\d)[ \-\.]?)?(?:\(?(\d{3})\)?[ \-\.])?(\d{3})[ \-\.](\d{4})(?: ?x?(\d+))?$/ # expanded version w/ comments ...
Ruby Phone number regex
by Lex,
October 31, 2008 16:00,
3 refactorings, tagged with phone number, regex, regexp, regular expression
I wrote this regex for pars...
1 2 3 4
require 'net/http' require 'uri' require 'strscan' ...
Ruby Display jpg image url from ...
This code display jpg image...
1 2 3 4
<?php function fetch($url,$start,$end){ ...
PHP Wikipedia API and text form...
by z3ro,
January 09, 2008 18:37,
1 refactoring, tagged with wikipedia, api, wikimedia, php, xml, regex, parser, formatting, plain html, html, convert
I need to add Wikipedia's i...
1 2 3
//function that loops through the elements function __validateForm(theform){ ...
JavaScript Simple form validator with ...
by eljota,
November 11, 2007 10:32,
5 refactorings, tagged with js, javascript, form, validation, regex
This is a real simple form ...
I have a map of strings whe...