Tag Archive for Expression

Remove Leading Whitespace (blanks) with Perl

$emailaddress =~ s/^s+//;

source

Remove HTML with Perl Regular Expression

$cleancode =~ s/<(.*?)>//gi;

source

Get Input Controls Name And Value In HTML Page

public static string GetInputControlsNameAndValueInPage(string strPage)
{
string strRegExPatten = "<s*input.*?names*=s*"(?<Name>.*?)".*?values*=s*"(?<Value>.*?)".*?>";
Regex reg = new Regex(strRegExPatten, RegexOptions.Multiline);
MatchCollection mc = reg.Matches(strPage);
string strTemp = string.Empty;
foreach (Match m in mc)
{
strTemp = strTemp + m.Groups["Name"].Value + "=" + m.Groups["Value"].Value + "&";
}
int n = strTemp.Length;
strTemp = strTemp.Remove(n - 1);
return strTemp;
}

source

height

/***** this sets the max-width value for all *****/
div#division {
max-width: 777px;
}

/***** this sets the max-width value for IE *****/
* html div#division {
width: expression( document.body.clientWidth > 776 ? "777px" : "auto" );
}

source

Mexican RFC RegEx

^[A-Za-z]{4}-d{6}(?:-[A-Za-zd]{3})?$

source

One liner perl extract content with regular expression

curl -s <a href="http://checkip.dyndns.org" >http://checkip.dyndns.org</a> | perl -nle 'print "$1" if (/Current IP Address: ([d.]*)/)'

source

Regular Expression to Separate the Anchor Part of a URL

private string GetAnchorPart()
{
string anchorExp = "[#].......";
Regex rex = new Regex(anchorExp);
Match anchorMatch = rex.Match(Request.RawUrl);
return anchorMatch.ToString();
}

source