regex

I know this regex can be simplified - .NET

Here are my requirements: 1-80 characters These characters are allowed: alphanumeric spaces _ ( ) [ ] ! # , . & * + : ' / - The regex I have below works, but in particular I'm not sure how to reuse the character class [\w\(\)\.\-\[\]!#,&*+:'\/] [\w\(\)\.\-\[\]!#,&*+:'\/][\w\s\(\)\.\-\[\]!#,&*+:'\/]{0,79} Update: ...

Using a changing variable in JQuery's nextAll()

Hi, With jquery, I'm dynamically adding rows. To do this, I'm copying the first of the table and then with some regex I'm changing the names and sometimes ids from thing like "column_name[0]" to "column_name[1]". This is the regex that I'm using: newRow = newRow.replace(new RegExp("\\[[0-9]+][\"\']", "gm"), "[" + $("#rowNum").val() ...

match a word that is not contained in parentheses

hello, i am trying to split a string by some keywords that aren't contained in parentheses... so, let's say i have the string "i will meet you where we talked (but not where he said)". i want to split the string into 2 pieces. one containing: "i will meet you", the other containing "we talked (but not where he said)". in other words, i ...

How to find recursion in your app?

My c# service got an internal .net execution error that points to recursion issue (e.g. stack overflow). The problem is that the service is pretty large, so I am having trouble finding where the recursion actually occurs. Can someone with massive regex mojo hook me up with a search string that would find what I need? ...

How do I redirect to my same URL without getting a too many redirects error?

I need to redirect users from http://myurl.com/Login.action to http://myurl.com/app/Login.action I tried this but I get an error saying I get too many redirects. RedirectMatch ([A-Za-z]*)\.action$ http://myurl.com/app/$1.action How can I get apache to redirect to the same URL but only redirect once. Would something like this work? R...

Parse HTML Page For Links With Regex Using Perl

Possible Duplicate: How can I remove external links from HTML using Perl? Alright, i'm working on a job for a client right now who just switched up his language choice to Perl. I'm not the best in Perl, but i've done stuff like this before with it albeit a while ago. There are lots of links like this: <a href="/en/subtitles/35...

regular expression question

I have user inputs such as these paul vs Team Apple Orange Team Apple Orange vs paul Team Apple Orange v.s. paul I need to write a regular expression that detects the words on both sides of the seperator (vs,vs.,v.s.) and store the side with the keyword "team" to variable team and the other to name. name = "paul" team = "Apple Orange...

PHP - regex to reformat JSON

Hi, I've been trying to figure out how to reformat multiple JSON files into a single one using php, but am having a difficult time understanding how to use complex regular expressions. Suppose I hade multiple instances of the following JSON data: { "felines": { "cats": [ { "age": 7, ...

sed regex to non-greedy replace?

I am aware of another question that is quite similar, but for some reason I'm still having problems. I have a GC log that I'm trying to trim out the Tenured section enclosed in []. 63.544: [GC 63.544: [DefNew: 575K->63K(576K), 0.0017902 secs]63.546: [Tenured: 1416K->1065K(1536K), 0.0492621 secs] 1922K->1065K(2112K), 0.0513331 secs] I...

A Simple Regular Expression Question

Hi everyone... this is maddeningly simple.... but i am still stumped whether my answer is right... i want to match a string with following format.... 70-60 50-40 100-90 //(Edit: changed from 100 -90 to 100-90) etc..... i started learning regex just today.... and i worked out the pattern /^[0-9]+-[0-9]+/$ to match the string ....

How to capture blocks of repetating text using regular expression?

Hi, I want to select blocks of text within given string. These blocks of text have almost similar pattern. For example, in text given below I want to capture line starting with "client" i.e. I want to select information of 3 clients given in text below. Sometimes this information may not start with word "client", it may start with word "...

Regex for parsing .strings files

I need a PHP Regex that can parse .strings files. In particular, it needs to be able to handle comments, blank lines, escaped characters and angle brackets. Example of a .strings file: /* string one */ "StringOne"="\"1\""; "StringTwo"="<2>"; /* Bob Dillon */ "Bob"="Dillon"; By request, the desired output would be something such as:...

How to modify/update a set of html files with a standard header and footer

I have a set of html files that I want to modify by replacing the header and footer. The contents of each file is different and I would like to use a regular expression (or similar if RE can't handle multiline queries). As an example, one modification I want to make is to replace everything between <html> and </head> with a standard he...

Check if a String only contains digits and the digits are not the same using REGEX?

111111111 - Invalid A121278237 - Invalid 7777777777 - Invalid 121263263 - Valid 111111112 - Valid ...

Regex: match everything but..

Hi to all, I need a regex able to match everything but a string starting with a specific pattern (specifically index.php and what follows, like index.php?id=2342343) Any help appreciated. Thanks ...

Extract float from text line with sed?

I am issuing a sed replace on a line, trying to extract a particular floating-point value, but all that appears to be matched is the right-side of the decimal Text Line: 63.544: [GC 63.544: [DefNew: 575K->63K(576K), 0.0017902 secs]63.546: [Tenured: 1416K->1065K(1536K), 0.0492621 secs] 1922K->1065K(2112K), 0.0513331 secs] If I issue s...

Working back a regex to form new input strings

Hello; I have a regular expression like: '/items\/a=(0-9)+\/b=(0-9)+/' which matches urls like: items/a=5/b=5, items/a=11/b=9 etc. (I hope the regex is correct, but please do not mind if it is not) What I want to be able to do is injecting values back into this regexp so lets say I have a=99, b=99 for values and I want to work out t...

How to match second <a> tag in this string.

Hi there. I have a HTML fragment which contains two anchor tags in various parts of the HTML. <span id="ctl00_PlaceHolderTitleBreadcrumb_ContentMap"><span><a class="ms-sitemapdirectional" href="/">My Site</a></span><span> &gt; </span><span><a class="ms-sitemapdirectional" href="/Lists/Announcements/AllItems.aspx">Announcements</a></sp...

Regular Expression - Repeating Groups

I'm trying to read a log file and extract some machine/setting information using regular expressions. Here is a sample from the log: ... COMPUTER INFO: Computer Name: TESTCMP02 Windows User Name: testUser99 Time Since Last Reboot: 405 Minutes Processor: (2 processors) Intel(R) X...

getting a substring from a regular expression

Here is the line of text: SRC='999' where 999 can be any three digits. I need a grep command that will return me the 999. How do I do this? ...