regex

JavaScript RegEx to change a string

I need to take strings in the following format: http:\/\/img.mypath.net\/time\/daily\/2010\/1006\/my_image_name.jpg And convert them to this, using JavaScript: http://www.mynewpath.com/i/daily/2010/1006/77_my_image_name.jpeg I'm sure that someone more fluent in RegEx than I can give a terse solution. ...

What would be the easiest way/technique to learn Regular Expression?

Possible Duplicate: Learning Regular Expressions I have found lots of ways by googling. Now I am really confused what should I follow, Or which part of which way will be better to learn. I think many of you have very good experiences and ideas about learning RegExp. Would you please share those experiences and/or ideas! that ...

How do i check if a substring matches with regex?

I want to find out if my string contains a certain substring and return true if it does and false if it doesnt. regex = /^[a-z0-9]*(TEST)+'[a-z0-9]*$/; if(myString.contains(regex)) { // do something } ...

Parse email address in Oracle to count number of addresses with 3 or less chars before @ sign

I need to count number of email addresses in a db that have 3 or less characters before the @ sign, for example [email protected]. The parsename function isn't present in Oracle and I'm not sure how to write a regexp for this. Any help would be greatly appreciated! ...

perl if-then-else logic and how to handle no data if regex doesn't match

So far, I have some working code that goes into a list of servers and does some regex to grab data from a log file. What I want to do is to pring out a status of "NOTHING TO REPORT FOR THIS SERVER" if there is NO data to capture from the regex on a particular server. Right now, it goes through each server and if data matches the regex,...

Regex using several repeatable capture groups

I have a very uniform set of data from Radius messages that I need to add into our log management solution. The product offers the ability to use a regex statement to pull out the various data in a few forms. 1) Individual regular expressions for each piece of data you wish to pull out <data 1 = regex statement> <data 2 = diff...

Having an issue with preg_match() in PHP

Hello SO: I am a bit rusty at PHP, so bear with me. I am making a simple email form that validates a few key pieces of data. One of these fields is the submitter's zip code. To validate this, I figured a regex would be simple since I am pretty confident the validation can be done in one line. Behold: preg_match("^([0-9]{5}|[0-9]{5}\-[0...

Next Capital letter using Regex Search

I use EditPlus. This tool has a nice search option where you can search either regular text or RegEx search. I want to search for the next Uppercase alphabet preceeded by a lowercase alphabet. What do I put in the search box for this? ...

Regex for Redirection problems (Cherokee Web Server)

Hello All, I'm having a real problem with this because I just can't get my head around regexes. I'm using Cherokee Web Server and I'm trying to use a regex to perform a redirection. I need to get the following url (for example) /parts/tr/accessories/tyres to the controller like this index.php?page=parts&catalogue=tr&category=acces...

htaccess ForceType application/x-httpd-php....

This is probably going to seem a little strange but we are using <Files "*"> ForceType application/x-httpd-php </Files> Which of course forces all files to give html/php headers.. The reason I am doing this way is because were using a bunch of extention'less php files. I know there is plenty more efficient ways of doing this but my b...

Python regex for fixing Australian/New Zealand Phone Numbers

heya, I have a Python script that we're using to parse CSV files with user-entered phone numbers in it - ergo, there are quite a few weird format/errors. We need to parse these numbers into their separate components, as well as fix some common entry errors. Our phone numbers are for Sydney or Melbourne (Australia), or Auckland (New Zea...

PHP expressions fail when changing from ereg to preg_match

I have a class that uses PHP's ereg() which is deprecated. Looking on PHP.net I thought I could just get away and change to preg_match() But I get errors with the regular expressions or they fail!! Here are two examples: function input_login() { if (ereg("[^-_@\.A-Za-z0-9]", $input_value)) { // WORKS // if (preg_match("[^-_@\....

How do I, RegEx Replace in msword C# :(

<name> Test 11 Test 22 </name> Replaced > <name> aaaaaaaaa </name> Hi, How can I determine the contents of a range in WinWord. How can I make for C# ...

.Net what new Regex(@"[ ]{2,}", options) means

What's happening in this code snippet ? RegexOptions options = RegexOptions.None; Regex regex = new Regex(@"[ ]{2,}", options); string outStr = regex.Replace(inStr, @" "); What I am looking for is to replace any sequences of "white" spaces ( including TAB, CR, LF ) with a single space. ...

Regular expression

Could anybody provide me the regular expression for the following patterns? $1234 $31234.3 $1234.56 $123456.78 $.99 My requirement is the digits before decimal should not exceed 6 and after the decimal point it should not exceed 2 digits. Please help me. Thanks in advance.. ...

Regex optimization question

As a personal learning exercise, I wrote this regex to split a unary string into parts whose length is increasing powers of two (see also on ideone.com): for (String s : new String(new char[500]) .split("(?=(.*))(?<=(?<=(^.*))\\G.*)(?<=(?=\\2\\2.\\1)^.*)") ) { System.out.printf("%s ", s.length()); } ...

Python Case Insensitive Replace without hurting re cache

Hey all, related question: http://stackoverflow.com/questions/919056/python-case-insensitive-replace What's the best way to do a case insensitive replace WITHOUT HURTING THE CACHE in the re module? I'm monitoring carefully the cache to make sure my favorite regexes stay there (speed, of course). I just notice that my code: ner_token_...

regex problem with Ctrl-M

I want to macth the following: boolean b = "\u000D".matches("\\cM"); but the compiler give me: unclosed string literal illegal character: \92 illegal character: \92 unclosed string literal not a statement why? that literal is not a valid unicode Ctrl-m unicode code??? ...

Regular Expression

How to write a regular expression for something that does NOT start with a given word Let's suppose I have the following list January February June July October I want a regular expression that returns all but June and July because they they start with Ju I wrote something like this ^[^ju] but this return any starting with J or U I...

I'd love to learn Regular Expressions, what would you suggest me to start off with?

Possible Duplicate: Learning Regular Expressions How to start off? Which software to use? ...