regex

One type of delimiter in one date time string in RegEx

Hi all, Is there any way to write a Regex that can validate one type of delimiter in one date time string only? For example, 30/04/2010 is correct but 30-04/2010 is incorrect. I googled and found something about backtrack but I am not very sure how to use it. For example, if i have this regex: (?P<date>((31(?![\.\-\/\—\ \,\–\-]{1...

How to match a string that does not end in a certain substring?

how can I write regular expression that dose not contain some string at the end. in my project,all classes that their names dont end with some string such as "controller" and "map" should inherit from a base class. how can I do this using regular expression ? ...

Regex for an email address doesn't work

Hi, I'm trying to check if some email address is correct with the following code : NSPredicate *regexMail = [NSPredicate predicateWithFormat:@"SELF MATCHES '.*@.*\..*'"]; if([regexMail evaluateWithObject:someMail]) ... But the "\." doesn't seem to work since the mail "smith@company" is accepted. Besides, I have the following warning...

javascript get function body

Hello, I have a function e.g. var test = function () {alert(1);} How can I get the body of this function? I assume that the only way is to parse the result of test.toString() method, but is there any other way? If parsing is the only way, what will be the regex to get to body? (help with the regex is extremly needed, because I am not...

SQL: extract date from string

There is a text field called myDate. This field can contain either 1) 'Fiscal year ending someDate' or 2) 'dateA to 'dateB'. In situation 1), I want to set the field date1 = to someDate. In situation 2), I want to set the field date1 = dateA and the field date2 = dateB. All the dates (someDate, dateA, dateB) can be written as 1/1/2000...

Regex: Check if string contains at leat one digit

Hi! I have got a text string like this: test1test and I want to check if it contains at least on digit using a regex. How would this regex look like? ...

JavaScript regex using strings?

Hi, How can I use strings as the 'find' in a JS regex? i.e.: var find = ["a", "b", "c"]; var string = "abcdefghijkl"; Now, I want to replace all the elements of the array find, with a blank string ( " " ), using regular expressions. How can I do this? I mean, using .replace(/find[i]/g, "") in a loop wouldn't work. So, how can I do...

Regular expression to find and replace unescaped Non-successive double quotes in CSV file.

This is an extension to a related question answered Here I have a weekly csv file which needs to be parsed. it looks like this. "asdf","asdf","asdf","asdf" But sometimes there are text fields which contain an extra unescaped double quote string like this "asdf","as "something" df","asdf","asdf" From the other posts on here, I was a...

How can I change this regular expression so grab the text before the FIRST colon and ignore the rest?

What do I have to change in this regular expression so that in both cases below it gets the text before the first colon as the "label" and all the rest of the text as the "text". using System; using System.Text.RegularExpressions; namespace TestRegex92343 { class Program { static void Main(string[] args) { ...

Passing an escaped String to JQuery($)-Function

Hi, currently I am trying to highlight elements on a page. Therefore I pass a comma seperate String to a Javascript-Funktion called highlight. highlight("main:box1,main:box2"); This was working fine till I found ids with : on the page. So I tried to escape them with a little regex. Here things started to get a little funny. If I esc...

Match all Strings without the word "authorize" in them

Possible Duplicate: Java \ Pattern - how to write a pattern that verifies the lack of a string? How can I match all strings without the word "authorize" in them via regular expressions? I tried *(authorize){0}* to no avail. ...

How i can create Reg Expression for the following number?

In c#, i gotta verify user inputs. Can someone tell me what will be the reg ex in order to verify this expression 12345-4521. <12345> = Any five digits only <-> = only hyphen <4521> = Any four digits only but last digit should either be 0 or 1. ...

Need help enhancing a Visual Studio Macro

Here's my current Macro Public Module CopyrightCode Sub AddCopyrightHeader() Dim doc As Document Dim docName As String Dim companyName As String = "Urban Now" Dim authorName As String = "Chase Florell" Dim authorEmail As String = "[email protected]" Dim copyrightText As String = "' ...

Help with Regex to match and rewrite URI

I need to have a RegEx that will match a URI like this based on the subdomain "blog"-- http://blog.foo.com/2010/06/25/city-tax-sale/ and redirect like this (getting rid of the subdomain and numbers/date)-- http://foo.com/city-tax-sale/ where the last bit "city-tax-sale" would be a wildcard. So basically any incoming URI that starts ...

Malformed UTF-8 character error in regular expression in Perl

I have 'Malformed UTF-8 character' error when I'm putting some scalar data in XML::Simple or Data::Dumper. There are regular expressions on the lines where the error occurs. Malformed UTF-8 character (fatal) at /usr/share/perl5/XML/Simple.pm line 1690. Malformed UTF-8 character (fatal) at /usr/lib/perl/5.10/Data/Dumper.pm line 682. At...

mysql select query pattern, get duplicates just once , regex, pattern

I have a database with 3 columns (item_number, seller_id, type) . I'm getting the columns content using while loop. $sql = msql_query("SELECT * FROM item_detals WHERE type='classifiedTitlePrice'"); while($row = mysql_fetch_array($sql)) { $item_number = $row['item_number']; $mcat = $row['mcat']; } However the problem is that a...

PHP regular expression to replace nested () with []

Hi. I am trying to match a string, see example, such that a nested parantheses () is replaced by [] so to not break a parser somewhere else. In this case, I would like to replace the $myStr with "Arman; Dario (10040 Druento (Turin), IT)" ... Thanks in advance! monte {x: $myStr = "Arman; Dario (10040 Druento (Turin), IT)"; $pa...

How to remove all break tags from a string in PHP?

Seems simple enough but I'm having some issues, I tried using preg_replace: preg_replace("<br />", "", $string); But what I get is this <> in place of the <br /> in the string when outputted. The break tags in the string will always be in this format not in any of these: <br/> <br> <BR /> etc. so what's the error I'm making? ...

Automata based alternative to re2

I am needing to implement regular expressions in a C++ program I am writing, and I wanted to use re2 but I could not compile it on windows. Does anyone know of another regular expression library or whatever it's called that compiles easily on windows and isn't a "backtracking" regex engine, but an automata-theory based one (whatever that...

What is wrong with the mod-rewrite regex?

I am trying to rewrite tagged.php?flag=parameter&page=1 into /parameter/?page=1 So I am using: RewriteRule Hotties/?(.*) tagged.php?flag=parameter&page=$1 However the result I am getting is: /parameter/?page= Which is the "1". I am not sure what is missing. Clearly the issue is with the (.) and the "=" but I am not sure wha...