RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Browse Expressions by Category

63 regular expressions found in this category!

Expressions in category: Markup/Code

Change page:   |    Displaying page 2 of 4 pages; Items 21 to 40
Title Test Details Quoted string
Expression
^(\x22|\x27)((?!\1).|\1{2})*\1$
Description
The regex validate a quoted string in VBScript or Ansi SQL. The string may contain the containing quote character if it is escaped by being doubled up. In VB/VBScript two double quotes within a string enclosed in double qoutes translate into one double quote within the string In SQL two single quotes within a string enclosed in single qoutes translate into one single quote within the string
Matches
"To quote Yoda (""Do, or do not. There is no 'try'"" )"
Non-Matches
'This won't validate' | "He said "Ok.""
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
(?n) (?# ExplicitCapture - capture named groups only ) ^ -? (?# Optional sign ) ( \d{1,8}(\.\d{1,2})? (?# Decimal point and trailing digits optional ) | \d{0,8}(\.\d{1,2}) (?# Leading digits optional ) ) $
Description
This pattern matches a simple Decimal Literal. Leading digits limited to 8 and does not support commification.
Matches
-14 | -14.26 | -.26
Non-Matches
-14. | -14.263 | -
Author Rating: Not yet rated. Darren Neimke
Title Test Details Enitity notation
Expression
& (?ni:\# # if a pound sign follow ampsand look for number ((x # if x follow pound sign accept hex value up to 5 digits ([\dA-F]){1,5} ) | # otherwise accept decimal number between 0 - 1048575 (104857[0-5] |10485[0-6]\d |1048[0-4]\d\d |104[0-7]\d{3} |10[0-3]\d{4} |0?\d{1,6}) ) | # no pound sign after ampersand ([A-Za-z\d.]{2,31}) #accept ASCII alphanumeric and period ); #end with semi-colon.
Description
This regex can be used to find general entites in HTML, XML and SGML files. The entity can consist of 1) an ampsand (&) 2) followed by (a) ASCII alphanumerics or period between 2 and 31 characters or (b) a pound sign # (i) followed by an x followed by a unicode value up to 5 hex digits or (ii) followed by a decimal value from 0 to 1048575 3) ending with a semi-colon (;)
Matches
&quote; | © | '
Non-Matches
& | &#Hello; | &#Xray;
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
/\*.+?\*/
Description
Searches for SQL comments within a T-SQL statement...
Matches
/* This is a T-SQL comment! */
Non-Matches
SELECT * FROM Customers
Author Rating: Not yet rated. Mike OBrien
Title Test Details Pattern Title
Expression
^\s*-?(\d*\.)?([0-2])?[0-9]:([0-5])?[0-9]:([0-5])?[0-9](\.[0-9]{1,7})?\s*$
Description
This should be the pattern described in the documentation for the .NET TimeSpan.Parse method - generally parses time spans. From the .NET docs: public static TimeSpan Parse(string s); The s parameter contains a specification of the form: [ws][-][d.]hh:mm:ss[.ff][ws] Items in square brackets ([ and ]) are optional, colons and periods (: and .) are literal characters, and other items are as follows. Item Description ws optional white space "-" optional minus sign indicating a negative time "d" optional days "hh" hours, ranging from 0 to 23 "mm" minutes, ranging from 0 to 59 "ss" seconds, ranging from 0 to 59 "ff" optional fractional seconds, from 1 to 7 decimal digits
Matches
10:12:34 | 932323.9:00:32.3420
Non-Matches
10:20:80
Author Rating: Not yet rated. Philipp Schumann
Title Test Details Pattern Title
Expression
(?<HTML><a[^>]*href\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>(?<Title>[^<]+|.*?)?</a\s*>)
Description
Powerful href extractor for HTML Element A. Groups extracted result separately that you can easily use HTML Element, URI or its title. These may be useful to: (?<HTML><area[^>]*href\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>) (?<HTML><form[^>]*action\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>) (?<HTML><frame[^>]*scr\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>) (?<HTML><iframe[^>]*scr\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>) (?<HTML><link[^>]*href\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>)
Matches
<a href='http://www.regexlib.com'>Text</a> | <a href="...'>Text</a> | &
Non-Matches
all other html tags
Author Rating: Not yet rated. Aivar Holyfield
Title Test Details Pattern Title
Expression
(?i:)(?<=\.)\D\D(?:-\D{2,3}?(?:-\D\D\D\D)?)?(?=.resx) #Just change the extension if you want to take a Culture out of different type of file name. #The result will always be of the format: #(2CharacterLanguage)-(2or3CharacterLocale)-(4CharacterScript) #where the second or third set are optional #this matches the format of the CultureInfo object in Microsoft .NET
Description
This expression pulls the Culture name out of a .resx file name.
Matches
blah.is.en.resx | something.zh-CHS.resx | something.uz-UZ-Cyrl.resx
Non-Matches
blah.is.eee.resx | something.zh-X.resx | something.uz-UZ-Uz.resx
Author Rating: Not yet rated. Eric Falsken
Title Test Details Pattern Title
Expression
(?<entryname>[\w_0-9]+)\s*=\s+\(\s*DESCRIPTION\s*=\s+\(\s*ADDRESS_LIST\s*=\s+\(\s*ADDRESS\s*=\s*\(\s*PROTOCOL\s*=\s*(?<protocol>\w+)\)\s*\(\s*HOST\s*=\s*(?<host>[^\)]+)\)\s*\(\s*PORT\s*=\s*(?<port>\d+)\s*\)\s*\)\s+\)\s+\(\s*CONNECT_DATA\s*=\s+\(\s*SERVICE_NAME\s*=\s*(?<svcname>\w+)\s*\)\s+\)\s+\)
Description
This regex is designed to parse entries from tnsnames.ora for Oracle connections. This is a crude first cut in that it doesn't allow for multiple ADDRESS entries in the ADDRESS_LIST section, and I don't know if there are other attributes that I should be allowing for. Basically, I just don't know enough about possible scenarios at this time, so I just wrote it to what I see in the wild where I work.
Matches
D007DEVL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = ddt210)(PORT =
Non-Matches
Anything that is not a tnsnames.ora entry
Author Rating: Not yet rated. Charles Farley
Title Test Details Pattern Title
Expression
\{\\\*\\bkmkstart\s(.*?)\}
Description
Applied to a .RTF document, returns all the names of the# bookmarks. Useful to retrieve# dinamically# the list of bookmarks from a document.
Matches
{\*\bkmkstart TagAmountDigits} | ({\*\bkmkstart TagAmountText}
Non-Matches
{\*\bkmkend TagAmountText}
Author Rating: Not yet rated. Fernando Eklipse
Title Test Details Pattern Title
Expression
href=[\"\']?((?:[^>]|[^\s]|[^"]|[^'])+)[\"\']?
Description
This will match just about everything after href= Its good if you just need a list of all the href= values
Matches
href="http://www.google.com/tsunami_relief.html" | href=/preferences?hl=en | href="ht
Non-Matches
src=blah blah
Author Rating: Not yet rated. Chris Richards
Title Test Details Pattern Title
Expression
(?mi:(?<=^(([^'"\n])|("[^"]*"))*[\t ])_(?=\s*$))
Description
looks for line concantenation character &quot;_&quot; in vb/vb.net source files. 1) It must be preceded by at least one space or tab. 2) It must be at the end of the line (okay if followed by whitespace) 3) And it must not be in commented code Used expression at http://www.regexlib.com/REDetails.aspx?regexp_id=371 for inspiration.
Matches
<XmlAttribute("xml-att")> _ | Sub WillGetThis() _ | "will ' get this" _
Non-Matches
' Won't get this _ | Sub wontGetThis()_ | "won't get this " _ "bad code"
Author Rating: Not yet rated. Christopher Strolia-Davis
Title Test Details Pattern Title
Expression
^[^']*?\&lt;\s*Assembly\s*:\s*AssemblyVersion\s*\(\s*&quot;(\*|[0-9]+.\*|[0-9]+.[0-9]+.\*|[0-9]+.[0-9]+.[0-9]+.\*|[0-9]+.[0-9]+.[0-9]+.[0-9]+)&quot;\s*\)\s*\&gt;.*$
Description
Matches the AssemblyVersion attribute in an Assembly.vb file. The version value is captured.
Matches
&lt;Assembly: AssemblyVersion(&quot;1.0.*&quot;)&gt; (all version formats, i.e.: * to 1.0.0.0)
Non-Matches
'&lt;Assembly: AssemblyVersion(&quot;1.0.*&quot;)&gt; (commented lines)
Author Rating: Not yet rated. Paolo Mazzini
Title Test Details Pattern Title
Expression
(?<commentblock>((?m:^[\t ]*\/{2}[^\n\r\v\f]+[\n\r\v\f]*){2,})|(\/\*[\w\W]*?\*\/))
Description
This expression will match comment blocks in javascript, c, c++, etc I wrote this as a named group called &quot;commentblock&quot;, as I like to use it with other expressions. It avoids single line comments or inline commented code (which are not considered comment &quot;blocks&quot;) unless the comments are in a /* text */ comment style could not create a multiline example in the matching examples, here is what I tried to enter // Some text //(must be two or more lines long and each line may only be preceded by whitespace)
Matches
/* Some text (may be any number of lines) */
Non-Matches
// Some text (only a single line) | Some code // comment here (even if next line has comment) | /* S
Author Rating: Not yet rated. Chris Strolia-Davis
Title Test Details Pattern Title
Expression
&lt;a[\s]+[^&gt;]*?href[\s]?=[\s\&quot;\']+(.*?)[\&quot;\']+.*?&gt;([^&lt;]+|.*?)?&lt;\/a&gt;
Description
This regex will extract the link and the link title for every a href in HTML source. Useful for crawling sites. Note that this pattern will also allow for links that are spread over multiple lines.
Matches
&lt;a href='http://www.regexlib.com'&gt;Text&lt;/a&gt; | &lt;a href=&quot;...&quot;&gt;Text&lt;/a&gt
Non-Matches
all other html tags
Author Rating: Not yet rated. Jacek Sompel
Title Test Details Pattern Title
Expression
(^[a-zA-Z][a-zA-Z0-9_]*)|(^[_][a-zA-Z0-9_]+)
Description
This pattern can be used for validating a string as a valid element name (e.g. variable or class name) in Microsoft .NET. See also http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vbconelementnames.asp
Matches
var | _withunder_score99 | TeSt
Non-Matches
_ | 123abc | 9
Author Rating: Not yet rated. Howard Richards
Title Test Details Pattern Title
Expression
(?=(?:[^\']*\'[^\']*\')*(?![^\']*\'))
Description
This exp will parse out space delimited strings with consideration to single quotes. I use it with SQL statements.
Matches
BETWEEN '11/1/2004' AND '12/1/2004 11:59:59 PM'
Non-Matches
flabberguasted
Author Rating: Not yet rated. Scott Richardson
Title Test Details Pattern Title
Expression
('.*$|Rem((\t| ).*$|$)|&quot;(.|&quot;&quot;)*?&quot;)
Description
Pulls out comments (both Rem and ') and string literals from VB or VBScript. Usefull for spell checking or review. Notes: The VBScript for &quot;Rem&quot; documentation says that it must be followed by a space but VBScript seems to accept tab characters as well. The multiline flag is assumed for this search.
Matches
' This is a comment | Rem This is a comment | &quot; This is a string with &quot;&quot; and ' &quot;
Non-Matches
&quot; This is not a string | RemThis is not a comment | This is not a comment or a string
Author Rating: Not yet rated. Ed Preston
Title Test Details Pattern Title
Expression
&lt;/?(\w+)(\s*\w*\s*=\s*(&quot;[^&quot;]*&quot;|'[^']'|[^&gt;]*))*|/?&gt;
Description
Matches HTML of XML tags, with or without attributes (single-, double-, or non-quoted), closing tags, or self-closing singleton tags.
Matches
&lt;font color=&quot;blue&quot;&gt; | &lt;/font&gt; | &lt;br /&gt;
Non-Matches
this is a test...
Author Rating: Not yet rated. Jean-Philip Losier
Title Test Details Pattern Title
Expression
<blockquote>(?:\s*([^<]+)<br>\s*)+</blockquote>
Description
Use this regular expression pattern to get the string1, string2, string3 .... from &lt;blockquote&gt;string1&lt;br&gt;string2&lt;br&gt;string3&lt;br&gt;&lt;/blockquote&gt;
Matches
<blockquote>string1<br>string2<br>string3<br></blockquote>
Non-Matches
..
Author Rating: Not yet rated. Waheed Khan
Title Test Details Pattern Title
Expression
^(#){1}([a-fA-F0-9]){6}$
Description
Matches HTML Color strings. Like #FFFFFF is white and #000000 is black and #FF0000 is red and so on...
Matches
#FFFFFF | #FF3421 | #00FF00
Non-Matches
232323 | f#fddee | #fd2
Author Rating: Not yet rated. Mladen Mihajlovic
Change page:   |    Displaying page 2 of 4 pages; Items 21 to 40

Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials