regex

Match groups in Oracle 10g2 regular expressions

I need to extract some data from malformed XML stored in an Oracle database. The XPath expressions would look like this: //image/type/text(). One take at a regular expression which would work in a similar fashion would be <image>.*?<type>(.+?)<\/type> (with appropriate flags for multiline matching). Since Oracle does not support match g...

regex expression

I am trying to get all the text between the following tags and it is just not workind If Not String.IsNullOrEmpty(_html) Then Dim regex As Regex = New Regex( _ ".*<entry(?<link>.+)</entry>", _ RegexOptions.IgnoreCase _ Or RegexOptions.Cul...

Find "word" index in paragraph with jQuery (Javascript)

I have a string that represents a paragraph of text. var paragraph = "It is important that the word cold is not partially selected where we search for the word old"; I want to be able to search this paragraph for the index of a "word" and have it do an exact match on a "word". For example, when searching for "old". I should only get...

How to parse a date from a URL format?

My database contains URLs stored as text fields and each URL contains a representation of the date of a report, which is missing from the report itself. So I need to parse the date from the URL field to a String representation such as: 2010-10-12 2007-01-03 2008-02-07 What's the best way to extract the dates? Some are in this forma...

Does this regex expression allow "*"?

I really know very little about regex's. I'm trying to test a password validation. Here's the regex that describes it (I didn't write it, and don't know what it means): private static string passwordField = "[^A-Za-z0-9_.\\-!@#$%^&*()=+;:'\"|~`<>?\\/{}]"; I've tried a password like "dfgbrk*", and my code, using the above regex,...

How do I remove content between X and Y using preg_replace?

What would the regular expression be for removing any content between a quote, and the directory "uploads/"? Using a regexpression generator, I get this: (?<=\=")[^]+?(?=uploads/) $block_data = preg_replace('/(?<=\=")[^]+?(?=uploads/)/g','',$block_data); But seems to be removing everything :( ...

Notepad++ non-greedy regular expressions

Does Notepad++ support non-greedy regular expressions? For example for text: abcxadc I want to get parts using pattern: a.+c And now I get whole string instead of 2 parts. I tried to use the '?' operator but without success. ...

ASP.NET regular expression to restrict consecutive characters

I apologize in advance for what is probably a simply question, but I suck at regular expressions and I did not find my answer via Google... My Question is as follows: Using ASP.NET syntax for the RegularExpressionValidator control, how do you specify restriction of two consecutive characters, say character 'x'? Thanks in advance... ...

PHP Regex Match parentheses

I am trying do a search to make sure that each of our product titles contains its manufacturer code. I am using preg_match but am getting some weird results back. Here is a snippet of code I wrote to go through the array of products... while($row = mysql_fetch_array($result)) { $products[''.$row[0].''][0] = $r...

How can I get my Perl regex not to use special characters from an interpolated variable?

Possible Duplicate: How can I escape meta-characters when I interpolate a variable in Perl's match operator? I am using the following regex to search for a string $word in the bigger string $referenceLine as follows : $wordRefMatchCount =()= $referenceLine =~ /(?=\b$word\b)/g The problem happens when my $word substring cont...

How do I change this Javascript Regular Expression to be non-case sensitive?

I have this regular expression below to validate a security question where some one has to type in the answer twice. My client want the answers to be none case sensitive. So if someone types in Chester and the in the second field they type in chester it will match. What can I do to this expression to make that happen: /^(\w|[a-zA-Z\d\...

How to replace "i" in <li>anything</li> using regex

How to replace "i" in <li>anything</li> using regex Code : var code = "<li>anything</li>"; // i don't know what is in <li>......</li> result should be : var code = "<li>anyth1ng</li>"; // i don't know what is in <li>......</li> ...

How can I use a regex to determine if a unumber is divisible by 5?

I am trying regex to find out whether a number is divisible by 10 or by 5. So basically, I am trying to see whether the number end in 0 or 5. This is my regular expression ^[1-9]*0?.0$ I encounter issues when the input is 100.0 or 55.0 What should the regular expression be? Thanks, Sandy ...

prevent user to type non-english characters

Hi, I am using this one to prevent user to type special chars. String.prototype.isText = function () {return /^[\w\s]*$/.test(this)} How can i change it to prevent users to type non-english words ? (only apostrophe and & will be accepted as special char) thanks so much ...

Regular expression remove tag after a paragraph with a given class

Is there a way to select all <br> tags that follow a paragraph with a given class? i.e. <p class="myclass">This is a paragraph</p><br> There may be other <br> in the HTML so I cannot use this: br {display:none;} and I cannot delete all <br> tags. If there is a way to select these particular <br> tags then I can use CSS. There are a...

Regex: Match any punctuation character except . and _

Is there an easy way to match all punctuation except period and underscore, in a C# regex? Hoping to do it without enumerating every single punctuation mark. ...

How do I create a Perl regex that matches non-alphanumeric characters except spaces?

I have a Perl regex /\W/i which matches all non-alphanumeric characters, but it also matches spaces which I want to ignore. How do I get it to match non-alphanumeric characters except spaces? ...

Is it possible to calucate the edit distance between a regexp and a string?

If so, please explain how. Re: what is distance -- "The distance between two strings is defined as the minimal number of edits required to convert one into the other." For example, xyz to XYZ would take 3 edits, so the string xYZ is closer to XYZ and xyz. If the pattern is [0-9]{3} or for instance 123, then a23 would be closer to the ...

String splitting issue problem with multiword expressions

I have a series of strings like: 'i would like a blood orange' I also have a list of strings like: ["blood orange", "loan shark"] Operating on the string, I want the following list: ["i", "would", "like", "a", "blood orange"] What is the best way to get the above list? I've been using re throughout my code, but I'm stumped with ...

Batch File: List all files not beginning with "SP"

Hello I have a DOS batch file that performs an action for files beginning with text "SP", as follows: FOR /F "tokens=*" %%A IN ( 'DIR SP*.sql /s /b' ) DO ECHO .compile_file = "%%A" >> output.txt The key bit here is obviously: DIR SP*.sql /s /b I need to do a similar thing before the "FOR" line above, but for all other files not st...