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 3 of 4 pages; Items 41 to 60
Title Test Details Pattern Title
Expression
(<meta\s+)*((name\s*=\s*("|')(?<name>[^'("|')]*)("|')){1}|content\s*=\s*("|')(?<content>[^'("|')]*)("|')|scheme\s*=\s*("|')(?<scheme>[^'("|')]*)("|'))
Description
Capture the attributes &quot;content&quot;, &quot;name&quot; and &quot;scheme&quot; used to parse META tags from any XHTML or HTML input. Useful for developers looking for expresions to parse &amp; get Dublin Core single elements from HTML pages.
Matches
<meta name="DC.subject" content="metadata"/>
Non-Matches
the other html constructs
Author Rating: Not yet rated. Ernesto Giralt
Title Test Details Pattern Title
Expression
(?s)/\*.*\*/
Description
Matches
/* .................... */ | /* imagine lots of lines here */
Non-Matches
*/ malformed opening tag */ | /* malformed closing tag /*
Author Rating: Not yet rated. Darren Neimke
Title Test Details Pattern Title
Expression
^(?&lt;path&gt;(/?(?&lt;step&gt;\w+))+)(?&lt;predicate&gt;\[(?&lt;comparison&gt;\s*(?&lt;lhs&gt;@\w+)\s*(?&lt;operator&gt;&lt;=|&gt;=|&lt;&gt;|=|&lt;|&gt;)\s*(?&lt;rhs&gt;('[^']*'|&quot;[^&quot;]*&quot;))\s*(and|or)?)+\])*$
Description
Simple parser of XPath, it doesn't handle the more complex statements but can be of use in some situations.
Matches
/root/child1/child2[ @param='value' ] | child1[@param &gt;= &quot;1&quot; and @foo &lt; 'asdf&quot;
Non-Matches
/root/*[ local-name() = 'child1' ][ child2/@param='value ]/child2
Author Rating: Not yet rated. Tim Walters
Title Test Details Pattern Title
Expression
(?i:)(?&lt;=\.)\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
(?&lt;HTML&gt;&lt;a[^&gt;]*href\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;(?&lt;Title&gt;[^&lt;]+|.*?)?&lt;/a\s*&gt;)
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: (?&lt;HTML&gt;&lt;area[^&gt;]*href\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;) (?&lt;HTML&gt;&lt;form[^&gt;]*action\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;) (?&lt;HTML&gt;&lt;frame[^&gt;]*scr\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;) (?&lt;HTML&gt;&lt;iframe[^&gt;]*scr\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;) (?&lt;HTML&gt;&lt;link[^&gt;]*href\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;)
Matches
&lt;a href='http://www.regexlib.com'&gt;Text&lt;/a&gt; | &lt;a href=&quot;...'&gt;Text&lt;/a&gt; | &
Non-Matches
all other html tags
Author Rating: Not yet rated. Aivar Holyfield
Title Test Details Pattern Title
Expression
(?&lt;entryname&gt;[\w_0-9]+)\s*=\s+\(\s*DESCRIPTION\s*=\s+\(\s*ADDRESS_LIST\s*=\s+\(\s*ADDRESS\s*=\s*\(\s*PROTOCOL\s*=\s*(?&lt;protocol&gt;\w+)\)\s*\(\s*HOST\s*=\s*(?&lt;host&gt;[^\)]+)\)\s*\(\s*PORT\s*=\s*(?&lt;port&gt;\d+)\s*\)\s*\)\s+\)\s+\(\s*CONNECT_DATA\s*=\s+\(\s*SERVICE_NAME\s*=\s*(?&lt;svcname&gt;\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
(?=(?:[^\']*\'[^\']*\')*(?![^\']*\'))
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
\{\\\*\\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
&lt;\*?font # Match start of Font Tag (?(?=[^&gt;]+color.*&gt;) #IF/THEN lookahead color in tag (.*?color\s*?[=|:]\s*?) # IF found THEN move ahead ('+\#*?[\w\s]*'+ # CAPTURE ColorName/Hex |&quot;+\#*?[\w\s]*&quot;+ # single or double |\#*\w*\b) # or no quotes .*?&gt; # &amp; move to end of tag |.*?&gt; # ELSE move to end of Tag ) # Close the If/Then lookahead # Use Multiline and IgnoreCase # Replace the matches from RE with MatchEvaluator below: # if m.Groups(1).Value&lt;&gt;&quot;&quot; then # Return &quot;&lt;font color=&quot; &amp; m.Groups(1).Value &amp; &quot;&gt;&quot; # else # Return &quot;&lt;font&gt;&quot; # end if
Description
This RE and MatchEvaluator will remove everything from inside HTML font tags EXCEPT the color declaration. (For ex: allow users to upload HTML content to site without their font tags overridding the font styles set in the CSS, except for the ability to change the font color for special emphasis.) This works with color declarations using single quotes, double quotes, no quotes, color-names (red, black), Hex colors (#669933), and inline Style declarations inside a font tag. Does not work with inline Style declarations inside other tags like DIV, SPAN, or P (although it could be expanded to include those as well).
Matches
&lt;font size=5 color=black face=Arial&gt; | &lt;font style=&quot;font-family:arial;color:red&quot;&
Non-Matches
&lt;DIV style=&quot;font-family:arial;color:red&quot;&gt; | &lt;SPAN style=&quot;color:red&quot;&gt;
Author Rating: Not yet rated. Cheri Verdend
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
(?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 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 &quot;-&quot; optional minus sign indicating a negative time &quot;d&quot; optional days &quot;hh&quot; hours, ranging from 0 to 23 &quot;mm&quot; minutes, ranging from 0 to 59 &quot;ss&quot; seconds, ranging from 0 to 59 &quot;ff&quot; 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
/\*.+?\*/
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
('.*$|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
>(?:(?<t>[^<]*))
Description
Detects HTML tags open and/or closed with and without whitespace or characters in between. Good for stripping all tags from a string.
Matches
<b> | </b> | <p><b>some text</b></p>
Non-Matches
<
Author Rating: Not yet rated. Jonathan Crossland
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
^(#){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
Title Test Details Pattern Title
Expression
(?'openingTag'&lt;) \s*? (?'tagName'\w+) # Once we've got the tagname, match zero # or more attribute sequences (\s*? # Atomic Grouping for efficiency (?&gt; (?!=[\/\?]?&gt;) # Lookahead so that we can fail quickly # match Attribute pieces (?'attribName'\w+) (?:\s* (?'attribSign'=) \s* ) (?'attribValue' (?:\'[^\']*\'|\&quot;[^\&quot;]*\&quot;|[^ &gt;]+) ) ) )* \s*? # Closing Tag can be either &gt; or /&gt; (?'closeTag'[\/\?]?&gt;)
Description
Matches and segments the sections of an opening tag. For more detailed information refer to this blog entry: http://weblogs.asp.net/dneimke/posts/25616.aspx
Matches
&lt;head&gt; | &lt;script language=javascript&gt; | &lt;input type=submit &gt;
Non-Matches
&lt;/head&gt;
Author Rating: Not yet rated. Darren Neimke
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;\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
Change page:   |    Displaying page 3 of 4 pages; Items 41 to 60

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