regex

regexp in bash (downloading output form regexp)

I have got a file that look like: <a href="some-adress">some-txt</a> <a href="some-adress">some-txt</a> <a href="some-adress">some-txt</a> ... I need to download all files that are as "some-adress", how can I do that using only bash? ...

regex throws StackOverFlow Error

Hi guys, I have a simple regexp question. I have the following multiline string: description: line1\r\nline2\r\n... And I am trying to find all the lines that come after the description:. I used the following regexp (and few more): description: ((.*\r\n){1,}) ...without any success. Then I found that there is a 'Regexp StackOver...

How to match "two or more words"

In a given string, I'm trying to verify that there are at least two words, where a word is defined as any non-numeric characters so for example // Should pass Phil D'Sousa Billy - the - Kid // Should Fail Joe 454545 354434 I thought this should work: (\b\D*?\b){2,} But it does not. ...

PHP: Match line against array of regexes

Hi, I'm writing a quick PHP parser here and was wondering instead of writing foreach($array as $line) { if(preg_match($regex1, ..) { } elseif(preg_match($regex2, ..) { } } Is there possible to match against an array of regexes? ...

how to narrow Google query to educational institution only(but not just to American ones)

I often search educational institutions websites with the following Google query my_query site:.edu or my_query site:edu.pl or my_query site:edu.au but it only crawls through American, Polish and Australian ones respectively. In most countries top level domain for universities is the country domain and edu is only a sub-domai...

php regex validation

Hi, just a quick question am abit rubish with regex so thought I would post on here. The regex below is to validate a username. Must be between 4-26 characters long Start with atleast 2 letters Can only contain numbers and one underscore and one dot I have this so far, but isn't working <?php $username=$_POST['username']; if (!ere...

Regular expression for filtering out JS + iframe

Hi, I'm looking for regular expression that will filter out: javascript: <script></script> and everything that is in between in between javascript also contains: iframe and hostads.cn url Thanks. I plan to use that regexp in simple bash script that will remove part of the code from the files in the directory. ...

Regular Expression literal with /g modifier and eval - weird behaviour in FireFox and Chrome

I was experiencing some weird behaviour in some of my javascript code, but only in Firefox and Chrome. IE is fine. I have isolated the problem and created a little page so you can see the behaviour yourself. Essentially, it appears as if the Regular Expression object in MethodC is being reused across method calls to MethodC, even thoug...

Get rid content between <!-- and // -->

I have a text file which is the result of parsed HTML into plain text file. I need to get rid of which is something like XHTML comment like the following shows: <!-- if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11); document.write ("<" +...

Regexercise: factorials

This is an experimental new feature for StackOverlow: exercising your regex muscles by solving various classical problems. There is no one right answer, and in fact we should collect as many right answers as possible, as long as they offer educational value. All flavors accepted, but please document it clearly. As much as practical, p...

Regex for robots.txt - disallow something within a directory, but not the directory itself...

I'm using wordpress with custom permalinks, and I want to disallow my posts but leave my category pages accessible to spiders. Here are some examples of what the URLs look like: Category page: somesite dot com /2010/category-name/ Post: somesite dot com /2010/category-name/product-name/ So, I'm curious if there is some type o...

Fast REGEX help, easy question

Here is the string $5 + $0.50 Sit & Go (185456218), Table 4 - 50/100 - No Limit Hold'em - Logged In As xxxxxx Right now I have the following REGEX to target the above (Cap\sPot\sLimit|Cap\sNo\sLimit|Pot\sLimit|No\sLimit|Limit)\s(Hold'em|Omaha\sH/L|Omaha\sHi|Stud\sH/L|Stud\sHi|Razz)(\s(\d+\sof\s\d+))?\s-\sLogged\sIn\sAs Obviou...

How do I specify a range of unicode characters in a regular-expression in python?

I am trying to match a range of Unicode characters and I am wondering how to do it. I can match simple ranges like [a-zA-Z] but how do I specify a range of Unicode characters. I've tried [#xD8-#xF6] without any luck. Any ideas? ...

[PHP] extract a line matching a phrase

hello, I want to match a whole line matching a word/phrase on that line! I tried this: preg_match("/PHRASE/i", $dictionary,$matches); But I get only the matched word! but I need that whole line! And there more than 15K lines! So I am looking for best way to do it! thanks in advance! ...

CKeditor - Custom tags and symbols inside the editorwindow.

When you insert a flash object into the CKeditor the editor window will show this symbol: I was wondering. Is it possible to do something similar when users inserts this tag into the editor (using regex {formbuilder=(\d+)}/ ): {formbuilder=2} If so, could someone please explain how to? :) UPDATE: I've been looking at the PageBreak...

'Regular Expression' VS 'String Comparison operators / functions'

Hello. This question is designed around the performance within PHP but you may broaden it to any language if you wish to. After many years of using PHP and having to compare strings I've learned that using string comparison operators over regular expressions is beneficial when it comes to performance. I fully understand that some oper...

Automatically have an outbound rule for every inbound rule?

I've recently moved my site from IIS6 to IIS7. My site uses URL-Rewriting which I had to re-input for the switch to IIS7 as the old URL-Rewriting seems incompatible with the new server. However, I've noticed that IIS7 doesn't automatically re-write my links. For example, if my page is called Folder1/Folder2/PageName and I'm rewriting fr...

parsing robots.txt file using c++

Hello, is there is any library to check robots.txt or else how can i right it in c++ with boost regex please explain with some examples.... ...

Testing Java regex appendReplacement()

I have developed a UI that allows users to define a regex pattern and then a replacement string that is used by appendReplacement(). e.g. Pattern - 7(.*) Replace pattern - $1 So 71234 would yield 1234. Is there anyway I can verify that the input pattern and replace pattern are compatible without the user having to enter a matching ...

Can someone give me a regular expression for a number to be between 1 and 5

Can someone give me a regular expression for a number to be between 1 and 5, single digit e.g. input has to be a number between 1 and 5 , 55 or 23 would not match ...