<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://regexadvice.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Performance</title><link>http://regexadvice.com/forums/69/ShowForum.aspx</link><description>Discuss performance implications of various regular expression designs.</description><dc:language>en</dc:language><generator>CommunityServer 2.1 (Build: 60809.935)</generator><item><title>Regualr expression for parsing String </title><link>http://regexadvice.com/forums/thread/84844.aspx</link><pubDate>Tue, 27 Mar 2012 18:12:16 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:84844</guid><dc:creator>stylish16</dc:creator><slash:comments>1</slash:comments><comments>http://regexadvice.com/forums/thread/84844.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=84844</wfw:commentRss><description>&lt;p&gt;Hello all,
&lt;/p&gt;&lt;p&gt;I am new to regular expressions.
&lt;/p&gt;&lt;p&gt;I want a regular expression which will allow only 10 characters in string.&lt;/p&gt;&lt;p&gt;It will not allow special characters (like comma, hyphen, asterisk, whitespace,....), numerals &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Thanks in advance.&lt;/p&gt;</description></item><item><title>Optimizing a string replacement algorithm in javascript</title><link>http://regexadvice.com/forums/thread/81965.aspx</link><pubDate>Mon, 09 May 2011 04:04:05 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:81965</guid><dc:creator>floss</dc:creator><slash:comments>3</slash:comments><comments>http://regexadvice.com/forums/thread/81965.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=81965</wfw:commentRss><description>&lt;div&gt;Ok so I have a rather slow algorithm that I would really love some advice to speed up! It may repeat many times over different large data strings. The string &amp;#39;data&amp;#39; contains &amp;quot;variables&amp;quot; (denoted by ${myVarName} in the data) that must be replaced with the value of the corresponding (either by id or name) element on the html page. I use javascript and jquery to do this. In particular, the line &amp;#39;\\$\\{&amp;#39;+rVars[key].replace(/([(])/g,&amp;quot;\\(&amp;quot;).replace(/([)])/g,&amp;quot;\\)&amp;quot;)+&amp;#39;\\}&amp;#39; surely can be replaced with some more efficient regex that I am not wizardy enough to invent. Perhaps I should be approaching this an entirely different way? I appreciate any help or advice!&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;remainingVars = data.match(/\$\{.*?\}/g);&lt;/div&gt;&lt;div&gt;rVars = new Array();&lt;/div&gt;&lt;div&gt;reg = &amp;#39;&amp;#39;;&lt;/div&gt;&lt;div&gt;if(remainingVars != null) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;	&lt;/span&gt;for(key=0; key&amp;lt;=remainingVars.length; key++) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;		&lt;/span&gt;if(remainingVars[key] != undefined &amp;amp;&amp;amp; remainingVars[key].length != undefined) {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;			&lt;/span&gt;rVars[key] = remainingVars[key].substr(2,remainingVars[key].length-3);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;			&lt;/span&gt;// In practice the following $(&amp;#39;body&amp;#39;) call is refined to a smaller context.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;			&lt;/span&gt;varVal = $(&amp;#39;body&amp;#39;).filter(&amp;#39;[name=&amp;quot;&amp;#39;+rVars[key]+&amp;#39;&amp;quot;],[id=&amp;quot;&amp;#39;+rVars[key]+&amp;#39;&amp;quot;]&amp;#39;).val();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;			&lt;/span&gt;reg = &amp;#39;\\$\\{&amp;#39;+rVars[key].replace(/([(])/g,&amp;quot;\\(&amp;quot;).replace(/([)])/g,&amp;quot;\\)&amp;quot;)+&amp;#39;\\}&amp;#39;;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;			&lt;/span&gt;if(varVal != undefined) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;				&lt;/span&gt;data = data.replace(RegExp(reg,&amp;#39;g&amp;#39;),varVal);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;			&lt;/span&gt;} else {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;				&lt;/span&gt;data = data.replace(RegExp(reg,&amp;#39;g&amp;#39;),&amp;#39;&amp;#39;);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre;"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;}&amp;nbsp;&lt;/div&gt;&lt;/div&gt;</description></item><item><title>Regular expression for htaccess URL redirect </title><link>http://regexadvice.com/forums/thread/80983.aspx</link><pubDate>Tue, 19 Apr 2011 20:26:52 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:80983</guid><dc:creator>innovator48</dc:creator><slash:comments>1</slash:comments><comments>http://regexadvice.com/forums/thread/80983.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=80983</wfw:commentRss><description>Hi All,&lt;br /&gt;&lt;br /&gt;I am trying to redirect all files in a particular directory in my web server.&lt;br /&gt;&lt;br /&gt;I am trying regular expressions such as &lt;br /&gt;Redirect /data/january\/([a-zA-Z0-9]*).([a-zA-Z]*)&amp;nbsp; http://www.mysite.com/sample &lt;br /&gt;&lt;br /&gt;The expression /([a-zA-Z0-9]*).([a-zA-Z]*) is trying to find expressions such as &amp;quot;dat35262.pdf&amp;quot;.&lt;br /&gt;&lt;br /&gt;But its not working. Can you help me out?&lt;br /&gt;&lt;br /&gt;Thanks in advance&lt;br /&gt;&lt;br /&gt;Ashish&lt;br /&gt;</description></item><item><title>what that regex  do???</title><link>http://regexadvice.com/forums/thread/71674.aspx</link><pubDate>Tue, 07 Sep 2010 07:55:43 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:71674</guid><dc:creator>ato2011</dc:creator><slash:comments>2</slash:comments><comments>http://regexadvice.com/forums/thread/71674.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=71674</wfw:commentRss><description>&lt;p&gt;(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?&lt;br /&gt;&lt;br /&gt;[a-fA-F0-9]{2}-[a-fA-F0-9]{2}-[a-fA-F0-9]{2}-[a-fA-F0-9]{2}&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;thx&lt;/p&gt;</description></item><item><title>identifying img tags in HTML</title><link>http://regexadvice.com/forums/thread/32770.aspx</link><pubDate>Mon, 09 Jul 2007 20:54:13 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:32770</guid><dc:creator>maximus_vj</dc:creator><slash:comments>3</slash:comments><comments>http://regexadvice.com/forums/thread/32770.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=32770</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;&amp;nbsp;I have to match image tags in HTML. Sample image tags that will be in my HTML are:&lt;/p&gt;&lt;p&gt;&amp;lt;img onresizestart=&amp;quot;return false;&amp;quot; title=&amp;quot;2 items addressed in Industrial Occupations&amp;quot; src=&amp;quot;/std_images/1015/1015_6642.gif&amp;quot; border=&amp;quot;0&amp;quot;&amp;nbsp; &amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;Which one is more efficient?&lt;/p&gt;&lt;p&gt;A) &lt;font size="2"&gt;&amp;lt;img[\s]*(.*?)[\s]*&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;OR&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;B) &lt;font size="2"&gt;&amp;lt;img[^&amp;gt;]*&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;Thanks&lt;/p&gt;&lt;p&gt;maximus_vj&lt;/p&gt;</description></item><item><title>Matching multiple values out of a large String</title><link>http://regexadvice.com/forums/thread/51964.aspx</link><pubDate>Sat, 04 Apr 2009 01:10:41 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:51964</guid><dc:creator>Mati</dc:creator><slash:comments>1</slash:comments><comments>http://regexadvice.com/forums/thread/51964.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=51964</wfw:commentRss><description>&lt;p&gt;Hello,&lt;br /&gt;
sometimes I extract several values out of large HTML-Files/Strings. Now i wonder which is better for performance: Put everything in one regular expression, or make one matching per value.&lt;/p&gt;

&lt;p&gt;For example: I have a a huge string which has values for &amp;quot;langid=&amp;quot;, &amp;quot;date=&amp;quot;, and &amp;quot;userid=&amp;quot;. These values are anywhere in the huge string. Now what is more performant on PCRE&amp;#39;s:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;preg_match(&amp;#39;/langid=(\d+).*?date=([0-9. ]+).*?userid=(\d+)/&amp;#39;, $largestring, $results); // METHOD 1&lt;/b&gt;&lt;br /&gt;
&lt;/p&gt;

&lt;p&gt;or one preg match for every value (METHOD 2):&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;preg_match(&amp;#39;/langid=(\d+)/&amp;#39;, $largestring, $lang);&lt;br /&gt;
preg_match(&amp;#39;/date=([0-9. ]+)/&amp;#39;, $largestring, $date);&lt;br /&gt;
preg_match(&amp;#39;/userid=(\d+)/&amp;#39;, $largestring, $user); &lt;/b&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;With Method 1 everything gets extracted in &amp;quot;one turn&amp;quot;, but the internal steps are doubled because of the backtracking (if i see it correctly), and with Method 2 the engine starts from the beginning everytime. Is this right? What is more performant in your eyes, and why?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>RegEx &quot;Expense&quot;?</title><link>http://regexadvice.com/forums/thread/51570.aspx</link><pubDate>Tue, 17 Mar 2009 15:17:21 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:51570</guid><dc:creator>Theresa Stewart</dc:creator><slash:comments>2</slash:comments><comments>http://regexadvice.com/forums/thread/51570.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=51570</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;I am new to this forum and to using RegEx, and looked within this category for an answer to my question, but could not find it.&lt;/p&gt;&lt;p&gt;I have the following situation:&lt;/p&gt;&lt;p&gt;(1)&amp;nbsp; Valid characters are stored within a SQL database for certain fields in a rather large UI.&lt;/p&gt;&lt;p&gt;(2)&amp;nbsp; I extract this valid characters String (in Java) and attempt to match it against one of my static (in a static HashMap), known patterns.&amp;nbsp; When found, I store a Key and the corresponding pattern so a caller may, in the future, use this pattern to validate a UI field either at the character-by-character or whole field level.&lt;/p&gt;&lt;p&gt;(3)&amp;nbsp; My first question is:&amp;nbsp; &amp;quot;How expensive is a RegEx for this type of application?&amp;quot;&amp;nbsp; I do see a section &amp;quot;slow RegEx&amp;quot;.&amp;nbsp; Is this where I would go to get further tips on improving performance?&amp;nbsp; Currently, I rely pretty heavily on (for instance):&amp;nbsp; &lt;/p&gt;&lt;p&gt;Pattern.compile(&amp;quot;[\\p{Alnum} .:-_\\/@$%[]!#\&amp;quot;]*&amp;quot;)&lt;/p&gt;&lt;p&gt;&amp;nbsp;where I use a &amp;quot;known&amp;quot; pattern and add legitimate characters to it. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;(4)&amp;nbsp; My next question is:&amp;nbsp; &amp;quot;Is there a way to dynamically create the pattern if it doesn&amp;#39;t &amp;quot;map&amp;quot; against my known patterns?&amp;quot;&lt;/p&gt;&lt;p&gt;Thank you,&lt;/p&gt;Theresa&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>how to test performance of PCRE algorithms? </title><link>http://regexadvice.com/forums/thread/50842.aspx</link><pubDate>Wed, 11 Feb 2009 07:12:55 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:50842</guid><dc:creator>zhodo947</dc:creator><slash:comments>0</slash:comments><comments>http://regexadvice.com/forums/thread/50842.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=50842</wfw:commentRss><description>Hi, I am new to regex and now I am trying to test the performance of the two algorithms in PCRE-7.8 by matching a large number of packets with a set of rules. I have some regular expressions from Snort but also need a large size of data (say 1 GB) with packets from 1KB to 1MB. Where can I find a handy tool to generate these data? Currently, I can only pass one pattern to match one string at a time in PCRE. Once I have these data, how can I pass all these packets and the regular expressions from Snort to the pcre? Is it possible to pass one file contains data and another file contains regular expressions to pcre? Thanks!&lt;br /&gt;</description></item><item><title>regular expression that splits a comlex pattern</title><link>http://regexadvice.com/forums/thread/47743.aspx</link><pubDate>Wed, 29 Oct 2008 17:00:50 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:47743</guid><dc:creator>walidali</dc:creator><slash:comments>1</slash:comments><comments>http://regexadvice.com/forums/thread/47743.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=47743</wfw:commentRss><description>&lt;p&gt;Hi everyone&amp;nbsp;anyone can help finding this text from a whole document &lt;/p&gt;&lt;p&gt;@&amp;quot;xxxxx&amp;quot;+M1,11[1,1]+&amp;quot;ddddd&amp;quot;+M1,2[17,12]&lt;/p&gt;&lt;p&gt;and then splitting this text&amp;nbsp;into &lt;/p&gt;&lt;p&gt;@&lt;/p&gt;&lt;p&gt;&amp;quot;xxxxx&amp;quot;&lt;/p&gt;&lt;p&gt;M1,11[1,1]&lt;/p&gt;&lt;p&gt;&amp;quot;ddddd&amp;quot;&lt;/p&gt;&lt;p&gt;M1,2&lt;/p&gt;&lt;p&gt;[17,12]&lt;/p&gt;&lt;p&gt;thx&lt;/p&gt;</description></item><item><title>any reason why not to (.+?)</title><link>http://regexadvice.com/forums/thread/45501.aspx</link><pubDate>Wed, 20 Aug 2008 17:21:07 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:45501</guid><dc:creator>edmondscommerce</dc:creator><slash:comments>7</slash:comments><comments>http://regexadvice.com/forums/thread/45501.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=45501</wfw:commentRss><description>&lt;p&gt;when regexing for stuff I generally use the format:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;lt;somthing always before&amp;gt;(.+?)&amp;lt;something always after&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;is there any particular reason why this is a bad idea? &lt;br /&gt;&lt;/p&gt;</description></item><item><title>regular expression </title><link>http://regexadvice.com/forums/thread/46885.aspx</link><pubDate>Sun, 05 Oct 2008 07:43:49 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:46885</guid><dc:creator>zregexAdvice</dc:creator><slash:comments>1</slash:comments><comments>http://regexadvice.com/forums/thread/46885.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=46885</wfw:commentRss><description>&lt;p&gt;i want an expression to avoid enter persian character in a textbox &lt;/p&gt;&lt;p&gt;anyone to help me?&lt;/p&gt;</description></item><item><title>What does this regex do?</title><link>http://regexadvice.com/forums/thread/42425.aspx</link><pubDate>Tue, 20 May 2008 19:06:09 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:42425</guid><dc:creator>hopeful</dc:creator><slash:comments>2</slash:comments><comments>http://regexadvice.com/forums/thread/42425.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=42425</wfw:commentRss><description>&lt;pre class="jive-pre"&gt;&amp;nbsp;Hello there, I have come across this regex I have tried my best to understand but no luke so far. Would anyone translate it to English words what is it trying to achive?&lt;/pre&gt;&lt;pre class="jive-pre"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="jive-pre"&gt;&lt;code class="jive-code jive-java"&gt;&lt;font color="red"&gt;(?&amp;lt;=(?:^| ))[a-z]&lt;/font&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class="jive-pre"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="jive-pre"&gt;&amp;nbsp;Thanks,&lt;/pre&gt;&lt;pre class="jive-pre"&gt;hope&amp;nbsp;&lt;/pre&gt;</description></item><item><title>regex engine creation</title><link>http://regexadvice.com/forums/thread/40418.aspx</link><pubDate>Tue, 18 Mar 2008 13:03:39 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:40418</guid><dc:creator>imdniel</dc:creator><slash:comments>1</slash:comments><comments>http://regexadvice.com/forums/thread/40418.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=40418</wfw:commentRss><description> hi..

   any book for how to implement a NFA based regular ex engine... ???? 
 

</description></item><item><title>Regular Expressions &lt;embed&gt; question</title><link>http://regexadvice.com/forums/thread/35112.aspx</link><pubDate>Tue, 25 Sep 2007 16:30:53 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:35112</guid><dc:creator>hotwheels</dc:creator><slash:comments>1</slash:comments><comments>http://regexadvice.com/forums/thread/35112.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=35112</wfw:commentRss><description>&lt;p&gt;Howdy all, i own a mustang enthusiast&amp;#39;s website, and i have been working with a program to embed video urls on my website. &lt;/p&gt;&lt;p&gt;I find that i can put together basic tags, like such: (The below is a working example for my website)&lt;/p&gt;&lt;p&gt;Site Url: &lt;a href="http://www.brightcove.tv/title.jsp?title=1201989799&amp;amp;channel=416537484"&gt;http://www.brightcove.tv/title.jsp?title=1201989799&amp;amp;channel=416537484&lt;/a&gt;&lt;/p&gt;&lt;p&gt;My regular expression: &lt;a href="http://www/.brightcove/.tv/title/.jsp/?title=([\w"&gt;http://www\.brightcove\.tv/title\.jsp\?title=([\w&lt;/a&gt;&amp;amp;;=]+) &lt;/p&gt;&lt;p&gt;My html: &amp;lt;embed src=&amp;#39;http://www.brightcove.tv/playerswf&amp;#39; bgcolor=&amp;#39;#FFFFFF&amp;#39; flashVars=&amp;#39;allowFullScreen=true&amp;amp;initVideoId=$p1&amp;amp;servicesURL=http://www.brightcove.tv&amp;amp;viewerSecureGatewayURL=https://www.brightcove.tv&amp;amp;cdnURL=http://admin.brightcove.com&amp;amp;autoStart=false&amp;#39; base=&amp;#39;http://admin.brightcove.com&amp;#39; name=&amp;#39;bcPlayer&amp;#39; width=&amp;#39;486&amp;#39; height=&amp;#39;412&amp;#39; allowFullScreen=&amp;#39;true&amp;#39; allowScriptAccess=&amp;#39;always&amp;#39; seamlesstabbing=&amp;#39;false&amp;#39; type=&amp;#39;application/x-shockwave-flash&amp;#39; swLiveConnect=&amp;#39;true&amp;#39; pluginspage=&amp;#39;http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash&amp;#39;&amp;gt;&amp;lt;/embed&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;So the way this works, is a user can go to brightcove.tv, watch a few video&amp;#39;s and finds one they want to share with other members. All they now have to do is grab the url from the address bar, post it as a New Thread and hit submit, and the embed video will play on my website.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now here is where i have a problem: (cannot figure out how to make 2 urls work together)&lt;/p&gt;&lt;p&gt;Site url: &lt;a href="http://www.godtube.com/view_video.php?viewkey=8f41a1d362d846af0b5e&amp;amp;page=1&amp;amp;viewtype=&amp;amp;category=mr"&gt;http://www.godtube.com/view_video.php?viewkey=8f41a1d362d846af0b5e&amp;amp;page=1&amp;amp;viewtype=&amp;amp;category=mr&lt;/a&gt;&lt;/p&gt;&lt;p&gt;My regular expession: &lt;a href="http://www/.godtube/.com/view_video/.php/?viewkey=([\w"&gt;http://www\.godtube\.com/view_video\.php\?viewkey=([\w&lt;/a&gt;]+)[&amp;amp;=;]&lt;/p&gt;&lt;p&gt;My html: &lt;font size="2"&gt;&lt;p&gt;&amp;lt;embed src=&amp;quot;http://godtube.com/flvplayer.swf&amp;quot; FlashVars=&amp;quot;videoThumb=http://www.godtube.com/thumb/1_30772.jpg&amp;amp;flvPath=http://www.godtube.com/flvideo1/47/30772.flv&amp;quot; wmode=&amp;quot;transparent&amp;quot; quality=&amp;quot;high&amp;quot; width=&amp;quot;330&amp;quot; height=&amp;quot;270&amp;quot; name=&amp;quot;flv_demo&amp;quot; align=&amp;quot;middle&amp;quot; allowScriptAccess=&amp;quot;sameDomain&amp;quot; type=&amp;quot;application/x-shockwave-flash&amp;quot; pluginspage=&amp;quot;http://www.macromedia.com/go/getflashplayer&amp;quot; /&amp;gt;&amp;lt;/embed&amp;gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&amp;lt;embed src=&amp;quot;http://godtube.com/flvplayer.swf&amp;quot; FlashVars=&amp;quot;videoThumb=http://www.godtube.com/thumb/1_30772.jpg&amp;amp;flvPath=http://www.godtube.com/flvideo1/47/30772.flv&amp;quot; wmode=&amp;quot;transparent&amp;quot; quality=&amp;quot;high&amp;quot; width=&amp;quot;330&amp;quot; height=&amp;quot;270&amp;quot; name=&amp;quot;flv_demo&amp;quot; align=&amp;quot;middle&amp;quot; allowScriptAccess=&amp;quot;sameDomain&amp;quot; type=&amp;quot;application/x-shockwave-flash&amp;quot; pluginspage=&amp;quot;http://www.macromedia.com/go/getflashplayer&amp;quot; /&amp;gt;&amp;lt;/embed&amp;gt;&lt;/p&gt;&lt;p&gt;As you can see, this example doesn&amp;#39;t work. The reason i have found is, it has a different embed url then the address bar url. The address bar calls for &lt;font size="2"&gt;&lt;p&gt;&lt;a href="http://www.godtube.com/view_video.php?viewkey=8f41a1d362d846af0b5e&amp;amp;page=1&amp;amp;viewtype=&amp;amp;category=mr"&gt;http://www.godtube.com/view_video.php?viewkey=8f41a1d362d846af0b5e&amp;amp;page=1&amp;amp;viewtype=&amp;amp;category=mr&lt;/a&gt; and the embed address is &lt;a href="http://www.godtube.com/flv1/47/30772.flv"&gt;http://www.godtube.com/flv1/47/30772.flv&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now how can i set up a regular expression that would use the address bar url, and connect to the embed url? &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks hotwheels&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.godtube.com/view_video.php?viewkey=8f41a1d362d846af0b5e&amp;amp;page=1&amp;amp;viewtype=&amp;amp;category=mr"&gt;http://www.godtube.com/view_video.php?viewkey=8f41a1d362d846af0b5e&amp;amp;page=1&amp;amp;viewtype=&amp;amp;category=mr&lt;/a&gt; and the embed address is &lt;a href="http://www.godtube.com/flv1/47/30772.flv"&gt;http://www.godtube.com/flv1/47/30772.flv&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now how can i set up a regular expression that would use the address bar url, and connect to the embed url? &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks hotwheels&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Which Regular Expression is correct about email</title><link>http://regexadvice.com/forums/thread/34320.aspx</link><pubDate>Sat, 01 Sep 2007 02:19:38 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:34320</guid><dc:creator>mycwcgr</dc:creator><slash:comments>2</slash:comments><comments>http://regexadvice.com/forums/thread/34320.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=34320</wfw:commentRss><description>&lt;p&gt;I need use email Regular Expression in my site &lt;a href="http://www.hothelpdesk.com/"&gt;http://www.hothelpdesk.com&lt;/a&gt; but I find several email Regular Expression&lt;/p&gt;&lt;p&gt;such as &lt;/p&gt;&lt;p&gt;^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$ &lt;/p&gt;&lt;p&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;&lt;a href="mailto:%5E.+@[%5E\.].*\.[a-z]%7B2,%7D$"&gt;^.+@[^\.].*\.[a-z]{2,}$&lt;/a&gt;&lt;/font&gt;&lt;/u&gt;&lt;a href="mailto:%5E.+@[%5E\.].*\.[a-z]%7B2,%7D$"&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>very slow expression !! strange behaviour</title><link>http://regexadvice.com/forums/thread/29343.aspx</link><pubDate>Mon, 30 Apr 2007 07:35:29 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:29343</guid><dc:creator>bashar_naffa</dc:creator><slash:comments>2</slash:comments><comments>http://regexadvice.com/forums/thread/29343.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=29343</wfw:commentRss><description>&lt;p&gt;Hi all,&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;m facing very strange behavior.&lt;/p&gt;&lt;p&gt;i&amp;#39;m trying to create regualr expression that will match the string: [any characters with spaces].[any characters with spaces]&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;amp; i don&amp;#39;t want to allow any chars before or after the string.&lt;/p&gt;&lt;p&gt;i create this expression:&lt;/p&gt;&lt;p&gt;^\[(\s*\w+\s*)+\]\.\[(\s*\w+\s*)+\]$&lt;/p&gt;&lt;p&gt;&amp;amp; using the .net as engine. IT TAKES 2 minutes or more to&amp;nbsp; match the input !?!?????&lt;/p&gt;&lt;p&gt;if i remove the $ Dollar , it works fine &amp;amp; fast. but the input may have non required additional character after the last bracket.&lt;/p&gt;&lt;p&gt;&amp;nbsp;any help or advice ? any anothrt optimized expression&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;thanks&amp;nbsp;&lt;/p&gt;</description></item><item><title>Find java class/function declarations</title><link>http://regexadvice.com/forums/thread/26645.aspx</link><pubDate>Thu, 25 Jan 2007 07:35:55 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:26645</guid><dc:creator>ziashahid</dc:creator><slash:comments>1</slash:comments><comments>http://regexadvice.com/forums/thread/26645.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=26645</wfw:commentRss><description>&lt;p&gt;hi all!
  &lt;/p&gt;&lt;p&gt;i want to find all the declaration of java class in a java file e.g. &lt;b&gt;public class myclass/ class myclass&lt;/b&gt; etc. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;And i also&amp;nbsp; want to find out all the&amp;nbsp; functions declaration with or without parameters in java file e.g. &lt;b&gt;public int fun1() / int fun2(int a, int b)&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I don&amp;#39;t want to consider curly braces in any of the above cases. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Any help will be highly appreciated.&lt;/p&gt;&lt;p&gt;Regards,&lt;/p&gt;&lt;p&gt;Zia&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Couting instances of a regular expression</title><link>http://regexadvice.com/forums/thread/25640.aspx</link><pubDate>Tue, 19 Dec 2006 10:26:16 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:25640</guid><dc:creator>king-ink</dc:creator><slash:comments>0</slash:comments><comments>http://regexadvice.com/forums/thread/25640.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=25640</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;I&amp;#39;m awfully sorry if this isn&amp;#39;t the right forum to place
this question, but I&amp;#39;d be much obliged if you pointed me to an
appropriate site where I can have my question answered.&lt;/p&gt;&lt;p&gt;Is
there an algorithm that efficiently measures the size of the instance
set of a regular expression? It&amp;#39;s easy to count the number of instances
of a regular expression composed of a series of concatenations, but I
need to count the instances of a regular expression that contains
branches. Any help would be appreciated.&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Rudi.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;&lt;p&gt;EDIT:
I should say that the solution I&amp;#39;ve come up with is to convert it to a
DFA and count the paths leading from the intial state to a final one,
but it becomes too inefficient for the kind of regexps I&amp;#39;m dealing
with.&amp;nbsp;&lt;/p&gt;</description></item><item><title>worse than exponential?</title><link>http://regexadvice.com/forums/thread/25534.aspx</link><pubDate>Thu, 14 Dec 2006 19:10:50 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:25534</guid><dc:creator>Syd</dc:creator><slash:comments>5</slash:comments><comments>http://regexadvice.com/forums/thread/25534.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=25534</wfw:commentRss><description>&lt;p&gt;I noticed that the regular expression ^([0-9][0-9_]?){1,20}! at times seems quite slow. The same with a maximum repeat count of 32 can match very quickly, but if the input string consists of only the characters 0-9 and _ but is longer than the pattern can match, the search takes longer than I have patience to ascertain. I went to a 1.5 hour lunch once, and it wasn't done when I got back. (Although that was a java implementation :-)&lt;/p&gt;
&lt;p&gt;I started trying to figure out what was going on, and discovered (using BBEdit), that, as might be expected, time to completion goes up as the maximum repeat count goes up. By a max of 23 it took 17 seconds (by my watch) on a test file, but a max of 24 took 31 seconds, even though it had only 21 records left to test (as opposed to 23). So I'm wondering:
&lt;br /&gt;* what is going on with this regular expression that it has such miserable performance?
&lt;br /&gt;* would some regular expression engines do better than others? (I've tried 2 or 3, with same results.)
&lt;br /&gt;* is there a better way to perform the same match? (2 to 40 characters, each from the set of digits plus underscore, except that underscore cannot be the first character and there cannot be two underscores in a row, all followed by an exclamation point)&lt;/p&gt;
&lt;p&gt;Thoughts, information, etc. appreciated.&lt;/p&gt;
&lt;p&gt;[BTW, in case anyone is interested, yes, this grew out of a desire to validate an e-mail address, as best as can be done, via a regular expression. In particular, I want a RelaxNG pattern (using W3C Schema Datatype library, and thus the W3C Schema regular expression language) to validate e-mail addresses. If I have lots of trouble, I'll post to the Construction Advice forum. If I'm successful, I'll post what I have to the library.]&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Addendum:&lt;/b&gt; I had planned to upload my test file, just to make it easy on anyone investigating, but I don't have sufficient permissions. The test file consists of 69 records, each one character longer than the other. Here are the first, middle, and last records:

&lt;br /&gt;1!
&lt;br /&gt;123456789_123456789_123456789_12345!
&lt;br /&gt;123456789_123456789_123456789_123456789_123456789_123456789_123456789!

&lt;/p&gt;</description></item><item><title>email validation only for certain specific ending email addresses</title><link>http://regexadvice.com/forums/thread/25088.aspx</link><pubDate>Thu, 30 Nov 2006 13:11:44 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:25088</guid><dc:creator>copperchair32</dc:creator><slash:comments>14</slash:comments><comments>http://regexadvice.com/forums/thread/25088.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=25088</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;I have been trying hard to find an email regular validation expression which will only allow email addresses which end in the same way. Meaning that after the @ it has to be the same. Therefore only people from the company (has the same ending to the email for emplyees)&amp;nbsp;will be able to register with the site. How can i go about this. email addresses go like:&lt;/p&gt;&lt;p&gt;&lt;a href="mailto:a.a.surname@building.company.co.uk"&gt;a.a.surname@building.company.co.uk&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Is there anybody who can help me?&lt;/p&gt;&lt;p&gt;&lt;img src="http://regexadvice.com/emoticons/emotion-6.gif" alt="Sad" /&gt;&lt;/p&gt;</description></item><item><title>Performance and more Performance...</title><link>http://regexadvice.com/forums/thread/15742.aspx</link><pubDate>Mon, 13 Mar 2006 15:19:39 GMT</pubDate><guid isPermaLink="false">d291b357-6366-4006-9008-4266c301325a:15742</guid><dc:creator>Cerebrus</dc:creator><slash:comments>12</slash:comments><comments>http://regexadvice.com/forums/thread/15742.aspx</comments><wfw:commentRss>http://regexadvice.com/forums/commentrss.aspx?SectionID=69&amp;PostID=15742</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Hi all,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Just came across this site, and immediately joined these forums.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Surprising that there is not a single post in this category. I must be the only one crazy enuf about this ! &lt;img src="/emoticons/emotion-3.gif" alt="Surprise [:O]" /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;I am familiar with drafting Regular expressions for my needs but wanted to understand how I can make them more efficient. I did search a lot for pointers on writing highly performant Regexes, but could find very less information. You can find thousands of sample Regexes for every need, but is anyone talking about which one searches faster.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;I understand that the difference comes in only when parsing rather large&amp;nbsp;files, but that's the type of files I usually get saddled with. Hence my concern.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;So, I would appreciate any pointers on writing efficient Regexes, increasing their performance and minimizing Backtracking etc. Links to useful articles are also highly appreciated.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Lastly, does anyone know of any tools out there that measure the comparative Performance of different Regular expressions. At present, I am using RegexBuddy's Debugger to elicit such information.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Thanks and Regards, &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Cerebrus.&lt;/FONT&gt;&lt;/P&gt;</description></item></channel></rss>