I have a file that contains:
something
something else
something else again
I need a bash command, sed/grep w.e that will produce the following output
something
something else
something else again
In other words, I need to remove multiple blank lines with just a single blank line. gred/sed are line based. I've never found a BA...
Here's the scenario. I'm using a url rewriter that allows me to specify patterns and redirects if they match, pretty typical stuff.
I'd like to add a new rule to the bottom of my rules that is a catch all, but only to a degree. I don't want it catching anything that ends in .aspx or is just plain empty.
I have this so far:
(.+)(?!\.as...
I'd like to match the contents within each paragraph in html using a python regular expression. These paragraphs always have BR tags inside them like so:
<p class="thisClass">this is nice <br /><br /> isn't it?</p>
I'm currently using this pattern:
pattern = re.compile('<p class=\"thisClass\">(.*?)<\/p>')
Then I'm using:
pattern.f...
Hello,
What is a good and portable regex library for C/C++? (C++ preferably)
...
I'm desperatly searching for a regular expression that match anything between a to z, A to Z, 0 to 9 and "-". The same regular expression must not match if the string being checked is equal to "admin".
I tried this :
/^(?!admin)|([-a-z0-9]{1,})$/i
but it doesn't work, it match for the string admin even if I added the negative lookahe...
Hi all,
I've tried to make a regex expression to match a piece of code, but no success.
The expression doesn't work in vs2008.
I've created this one:
/\*<parameters>\*/(?<value>[\r\n]*.*)/\*</parameters>\*/
the source to match is:
/*<parameters>*/
@parameter blue
,@parameter2 red
,@parameter3 green
,@parameter4 yellow /*</paramet...
Hi. I'm trying to use python to parse a log file and match 4 pieces of information in one regex. (epoch time, SERVICE NOTIFICATION, hostname and CRITICAL) I can't seem to get this to work. So Far I've been able to only match two of the four. Is it possible to do this? Below is an example of a string from the log file and the code I've go...
What is the regular exp for a text that can't contain any special characters except space?
...
Reluctant quantifiers can be very useful. However, I can't think of any use of ??, the reluctant version of ?. Can somebody give me an example, or is it just there because the other quantifiers have reluctant versions too?
...
I am getting myArray as null. Can anyone help me?
myRe = new RegExp ("[A-Z]+(\\d+)");
myArray = myRe.exec("book1");
alert(myArray.length);
...
I'm using VB.Net in an ASP.Net 2.0 app to run some regular expressions that remove some unnecessary markup. One of the things that I'd like to do is remove span elements that don't have any attributes in them:
output = Regex.Replace(output, "<span\s*>(?<Text>.*?)</span>" & styleRegex, "${Text}", RegexOptions.Compiled Or RegexOptions.Cul...
My text file contains 2 lines:
<IMG SRC="/icons/folder.gif" ALT="[DIR]"> <A HREF="yahoo.com.jp/">yahoo.com.jp/</A>
</PRE><HR>
In my Perl script, I have:
my $String =~ /.*(HREF=")(.*)(">)/;
print "$2";
and my output is the following:
Output 1: yahoo.com.jp
Output 2: ><HR>
What I am trying to achieve is have my Perl script automa...
I have this regex working but now need to allow numbers without the decimal as well
// Validate for 2 decimal for money
jQuery.validator.addMethod("decimalTwo", function(value, element) {
return this.optional(element) || /^(\d{1,3})(\.\d{2})$/.test(value);
}, "Must be in US currency format 0.99");
Currently this forces the user to...
Hi!
I have been playing with JFlex and at this moment I want to get a regex that match a square bracket "[", but I don't find it. I think I tried all posivilities but the right.
Some help?
...
Is it possible for a regex to match based on other parts of the same regex?
For example, how would I match lines that begins and end with the same sequence of 3 characters, regardless of what the characters are?
Matches:
abcabc
xyz abc xyz
Doesn't Match:
abc123
Undefined: (Can match or not, whichever is easiest)
ababa
a
Ideall...
Hello all,
I am in the process of trying to create a macro that will, through a combination of code and Regular Expressions, clean-up and apply consistant formatting to our library of SQL Scripts.
My macro consists of 2 parts. The first section loops through a collection of SQL key words (select, from, where, etc..) and uses the Find o...
How do I match something thats "A known part (unknown word) (the rest of the string)" in a perl-style regex (PCRE)?
...
I have a database full of names like:
John Smith
Scott J. Holmes
Dr. Kaplan
Ray's Dog
Levi's
Adrian O'Brien
Perry Sean Smyre
Carie Burchfield-Thompson
Björn Árnason
There are a few foreign names with accents in them that need to be converted to strings with non-accented characters.
I'd like to convert the full names (...
Hello,
I'm trying to use Regex in C# to look for a list of keywords in a bunch of text. However I want to be very specific about what the "surrounding" text can be for something to count as a keyword.
So for example, the keyword "hello" should be found in (hello), hello., hello< but not in hellothere.
My main problem is that I don't R...
I don't know if that's the right word for it, but I am trying to come up with some regex's that can extract coefficients and exponents from a mathematical expression. The expression will come in the form 'axB+cxD+exF' where the lower case letters are the coefficients and the uppercase letters are the exponents. I have a regex that can ...