regex

what's wrong with this regex for password rules

I'm trying for at least 2 letters, at least 2 non letters, and at least 6 characters in length: ^.*(?=.{6,})(?=[a-zA-Z]*){2,}(?=[0-9@#$%^&+=]*){2,}.*$ but that misses the mark on many levels, yet I'm not sure why. Any suggestions? ...

Converting UUIDs from one format to another

I have an SQL document formatted as so (It has about 3000 entries like so): INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) VALUES('99b857afcb2e4f7dbf8657ea916ad9d7',FALSE,'SPACE') INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) VALUES('df8480e333c044f08ada939c66fa13f5',FALSE,'AIR') INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) ...

Regex to capture variables

I am trying to use an HTML form and javascript (i mention this, because some advanced features of regex processing are not available when using it on javascript) to acomplish the following: feed the form some text, and use a regex to look into it and "capture" certain parts of it to be used as variables... i.e. the text is: "abcde ...

Can I capture "Unrecognized escape" warning when compiling a regex?

I'm reading a regular expression from a configuration file, which may or may not have invalid syntax in it. (It's locked down behind a firewall, so let's not get into security.) I've been able to test for a number of errors and give a friendly message. No such luck on this one: Unrecognized escape \Q passed through in regex I k...

escaping question mark in regex javascript

Hi,..simple questions I think I am trying to search for the occurrence of a string in another string using regex in javascript like so: var content ="Hi, I like your Apartment. Could we schedule a viewing? My phone number is: "; var gent = new RegExp("I like your Apartment. Could we schedule a viewing? My", "g"); if(content.sear...

Find and replace patterns in a string

Hi all, My string (champs1 (champs6 donnee_o donnee_f) [(champs2 [] (champs3 _YOJNJeyyyyyyB (champs4 donnee_x)) (debut 144825 25345) (fin 244102 40647)), (champs2 [] (champs3 _FuGNJeyyyyyyB (champs4 donnee_z)) (debut 796443 190570) (fin 145247 42663))] [] []). ( Annotated For readability ): (champs1 (champs6 donnee_o donnee_f...

Textmate whitespace highlighting

I want to modify the solution for highlighting trailing whitespace described here by NOT highlighting whitespace on otherwise empty lines. I've modified this in my Python language file: { match = '(\s+)$'; captures = { 1 = { name = 'invalid.whitespace'; }; }; }, To this: { match = '\S(\s+)$'; captures = { 1 = { name =...

Should I use \d or [0-9] to match digits in a Perl regex?

Having read a number of questions/answers over the past few weeks, I have seen the use of \d in perl regular expressions commented on as incorrect. As in the later versions of perl \d is not the same as [0-9], as \d will represent any Unicode character that has the digit attribute, and that [0-9] represents the characters '0', '1', '2', ...

Clearer way to parse a token out of a string in ruby

I'm trying to clean up something for the hell of it, and looking for some better ways of going about it. The idea is that instead of using regular expressions in my rules for parsing a string, I'd like to use something closer to the routes syntax "something/:searchitem/somethingelse", then given a string like "/something/FOUNDIT/somethin...

basic php regex question

I have an html file where I'd like to get all the text inside these two tags: <div class="articleTitle"> </div> I'm not entirely sure how to do the php regex. (I also know there are no html tags inside the div, so there's no problem about nested tags) update: when i try the solutions given i get this: Warning: preg_match() [function...

Javascript regex - why is it not working as expected on IE?

After loosing much sleep I still cannot figure this out: The code below (its a simplification from larger code that shows only the problem) Identifies Item1 and Item2 on FF but does not on IE7. I'm clueless. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <htm...

Rewrite for all URLs

I would like to rewrite something like: http//www.example.com/index.php?var1=val1&var2=val2&var3=val3 Into http://www.example.com/var1/val1/var2/val2/var3/val3/ I'm looking for a solution to work on an arbitrary number of variables. Can it be done? ...

VBScript RegExp not Greedy Enough

I am trying to write a simple sql parser to break a sql statement into its basic parts. However, I'm having a problem with nested queries. An example illustrates best: sql = "select * from Customers where id in (select customer_id from Orders where 1=1)" Set re = New RegExp re.IgnoreCase = True re.Pattern = "^(.*)\swhere\s(.*)$" re.Gl...

Why is the JavaScript RegExp.test() method behaving as a toggle?!

Can anyone explain why the alert() in the following JavaScript code is firing? It appears to be a bug in the RegExp.test() method which reverses its previous decision each time you run the method. I'm using IE7. I've found a replacement that appears solid, using the string.search(regex) method instead. But, I'm curious whether anyone...

Regular Expression to match multiple query string parameter/value pairs.

About to work through this one, but thought someone may have already had to tackle it, so... I'm looking for an elegant (and isapi rewrite compatible) regular expression to look for three known parameter/value pairs in a querystring, regardless of order, and also extract all other parameters while stripping out those three. abc=123 def...

Automatic regex builder

I have N strings. Also, there are K regular expressions, unknown to me. Each string is either matching one of the regular expressions, or it is garbage. There are total of L garbage strings in the set. Both K and L are unknown. I'd like to deduce the regular expressions. Obviously, this problem has infinite number of solutions. I need ...

regular expression to disallow combination of characters

I am not very famliar with using anything but very basic regular expression. I have a field that allows all characters except single quote, double quote and question mark (I know, not a good idea, but what can I say. My customers will not budge on this requirement.) Now, a new requirement is added. The character combination of @# is also...

Regex in Postgres - not doing what I'm trying to do (newbie question)

I have this regex in a query in postgres and I cannot figure out why it is not matching anything after the text specified in the regex; The idea is removing the last part, including the separator characters between. I have records like these to match: Villa hermosa, Pilar, PCIA. BS. AS. Esmeralda - Pilar - BUENOS AIRES. San Ma...

What is the regular expression for a Spanish word?

Regular expression languages use \B to include A..Z, a..z, 0..9, and _, and \b is defined as a word boundary. How can I write a regular expression that matches all valid Spanish words, including characters such as: á, í, ó, é, ñ, etc.? I'm using .NET. ...

RegExp: currency format

Hello guys, I need to format numbers so that thousands were not separated by anything and hundreds were separated with a dot. For example 1234.56 12.34 123 I wrote the following ReqExp amountValue.replace(/^(\d+)[,.](\d{3})[.,](\d{2})$/,'$1' + '$2' +'.'+'$3').replace(/^(\d+),(\d{2})$/,'$1' +'.'+'$2'); If there a way to make it sho...