I am trying to match what is before /../ but after / with a regular expressions, but I want it to look back and stop at the first /
I feel like I am close but it just looks at the first slash and then takes everything after it like... input is this:
this/is/a/./path/that/../includes/face/./stuff/../hat
and my regular expression is:
...
Previously, on StackOverflow ...
(Summarized)
I need to capture all requests, for a
particluar subdomain .. and rewrite
their destination.
Now, the trick to determining the host via regex was solved.
Now, i need to make sure all requests to the root index page is rewritten, but i can't figure out the correct regex to find...
This is similar to my previous efforts (wordEnds and repeatEnd): as a mental exercise, I want to solve this toy problem using regex only.
Description from codingbat.com:
Given a string and a non-empty word string, return a version of the original string where all chars have been replaced by pluses ("+"), except for appearances of th...
Is it possible to write a regular expression for finding a typical file matching pattern.
e.g. File<13/04/2010>.txt should be picked up and not any other file.
i.e. Starting file name will be File followed by some dates and then the file extension.
If so, can we specify this pattern in the config file?
Looking for the solution in C#
...
I need an expression which matches,DateTime format (DD/MM/YYYY),i've already found it.
However,it only works to (1/6/2009) or (1/5/2010),it doenst support (01/06/2009) or (01/05/2010).
How can i check if a string is a dateTime in Javascript?
...
I have a strange problem with the validation I am writing on a form. It is a 'Check Username' button next to an input. The input default value is the username for example 'betamax'. When I press 'Check Username' it passes the regex and sends the username to the server. The server behaves as expected and returns '2' to tell the javascript...
I need a regex that will match blahfooblah but not blahfoobarblah
I want it to match only foo and everything around foo, as long as it isn't followed by bar.
I tried using this: foo.*(?<!bar) which is fairly close, but it matches blahfoobarblah. The negative look behind needs to match anything and not just bar.
The specific language I...
The following javascript code concatenates the matches found by a regular expression. The regular expression should find any word or set of quoted words. It seems to work perfectly in FireFox and Chrome, but its not working correctly in IE (i have only tested it on IE8).
var searchString = '';
var notString = 'dog cat "pirate ship"';
va...
Hello, I am trying to manipulate a conditional string outputted from SAS into the right format for a conditional statement in R. Here is an example of the conditional outputted from SAS:
. < var1_a<=80 and var2_a>50.8
I've written a function that handles some of the transformation necessary:
conditonalsub <- function(x) {
subnew <- ...
How can I specify to only match the first occurrence of a regular expression in C# using the Regex method?
Here's an example:
string text = @"<link href=""/_layouts/OracleBI/OracleBridge.ashx?RedirectURL=res/sk_oracle10/b_mozilla_4/common.css"" type=""text/css"" rel=""stylesheet""></link></link>";
string pattern = @"(<l...
Is it possible to construct a PCRE-style regular expression that will only match each letter in a list only once?
For example, if you have the letters "lrsa" and you try matching a word list against:
^[lrsa]*m[lrsa]*$
you're going to match "lams" (valid), but also "lamas" (invalid for our purposes because you only had one "a"). If yo...
Can anyone provide a regex for notepad++ for the below search and replace (conversion)
ADD ( PRIMARY KEY (xxx) ) ;
to
ADD PRIMARY KEY (xxx) ;
basically, removed a () around primary key expression. the value xxx is different among statements.
If not notepad++, I may also try the regex for vim or any shell script.
thanks a lot.
B...
I need to extract parts of a string using regex in Python.
I'm good with basic regex but I'm terrible at lookarounds. I've shown two sample records below. The last big is always a currency field e.g. in the first one it is 4,76. In the second one it is 2,00. The second has an account number that is the pattern of \d{6}-\d{6}. Anything a...
What is the fastest way in PHP to take a keyword list and match it to a search result (like an array of titles) for all words?
For instance, if my keyword phrase is "great leather shoes", then the following titles would be a match...
Get Some Really Great Leather Shoes
Leather Shoes Are Great
Great Day! Those Are Some Cool Leather Sho...
I'm trying to replace a friendly url pattern with a html url notation but due to lack of regex experience I can't figure out why my regex only replaces the first occurence of my pattern:
string text = "[Hotel Des Terrasses \http://flash-hotel.fr/] and [Du Phare \http://www.activehotels.com/hotel/]";
text = Regex.Replace(text, @"\[(.+)\s...
I'm pretty experienced with Perl and Ruby but new to Python so I'm hoping someone can show me the Pythonic way to accomplish the following task. I want to compare several lines against multiple regular expressions and retrieve the matching group. In Ruby it would be something like this:
# Revised to show variance in regex and related ...
Excuse my ignorance.
I need to replace all data in a mysql field before and including the first # .
example field = golfers
data at the first hole the golfer missed a 9 inch putt and said "#hit it bad
new data hit it bad
...
I use jquery.autocomplete, which uses a javascript regexp to highlight substrings in the list of suggestions that match the autocomplete key string. So if the use types "Beat" and one of the autocomplete suggestions the server returns is "The Beatles" then plugin displays that suggestion as "The Beatles".
I'm trying to think of ways to ...
Hi folks,
this one is really easy.
I'm trying to create a Regular Expression that will result in a Successful Match when against the following text
/default.aspx?
So i tried the following...
^/default.aspx$
and it's failing to match it.
Can someone help, please?
(i'm guessing i'm screwing up becuase of the \ and the ? in the in...
Is there any better way to get take a string such as "(123) 455-2344" and get "1234552344" from it than doing this:
var matches = Regex.Matches(input, @"[0-9]+", RegexOptions.Compiled);
return String.Join(string.Empty, matches.Cast<Match>()
.Select(x => x.Value).ToArray());
Perhaps a regex pattern that...