Hello all,
I am really stuck with these 2 question for over 2 days now. trying to figure out what the question means.... my tutor is out of town too....
write a regular expression for the only strings that are not generated over {a,b} by the expression: (a+b)*a(a+b)*. explain your reasoning.
and i tried the second question, do you thi...
I am trying to figure out a regular expression which matches any string with 8 symbols, which doesn't equal "00000000".
can any one help me?
thanks
...
There are so many questions on regex-negation here on SO.
I am not sure I understand why people feel the need to negate a regex.
Why not use something like grep -v that shows only the results that do not match the regex?
$ ls
april august december february january july june march may november october september
$ ls | grep...
Hello,
Let's suppose that we have such HTML code. We need to get all <a href=""></a> tags which DO NOT contain img tag inside it.
<a href="http://domain1.com"><span>Here is link</span></a>
<a href="http://domain2.com" title="">Hello</a>
<a href="http://domain3.com" title=""><img src="" /></a>
<a href="http://domain4" title="">...
I'm trying to parse a text file into sentences ending in periods, but names like Mr. Hopkins are throwing false alarms on matching for periods.
What regex identifies "." but not "Mr."
For bonus, I'm also using ! to find end of sentences, so my current Regex is /(!/./ and I'd love an answer that incorporates my !'s too.
...
I'm setting up some goals in Google Analytics and could use a little regex help.
Lets say I have 4 URLs
http://www.anydotcom.com/test/search.cfm?metric=blah&selector=size&value=1
http://www.anydotcom.com/test/search.cfm?metric=blah2&selector=style&value=1
http://www.anydotcom.com/test/search.cfm?metric=blah3&selecto...
Hi!
Is it possible to write a regexp rule in "one line" that says: neither A nor B.
For example:
String must contain NEITHER "foo" NOR "bar".
Why one line? Because the filtering tool I am using accepts only one line ... I have tried things like (.*foo.*){0}(.*bar.*){0} without enough luck.
...
(If you can make a better title, please do)
Hi,
I need to make sure a string matches the following regex:
^[0-9a-zA-Z]{1}[0-9a-zA-Z\.\-_]*$
(Starts with a letter or number, then any number of letters, numbers, dots, dashes or underscores)
But given that, I need to make sure it doesn't match a Guid, my Guid matching reg-ex looks like...
I have a string that needs to be validated.
The first two characters must be made up A-G, or Z, but cannot be the following combination: GB or ZZ.
How do I express that in a regular expression?
...
Hi,
I want to be able to construct a regular expression which searches for a particular pattern in some HTML code where one parameter is negated (i.e. find x where y is NOT present).
Example: I want to find image width parameters where width does not equal "500".
width="640" height="360" would match
width="500" height="360" would NOT...
To not match a set of characters I would use e.g. [^\"\\r\\n]*
Now I want to not match a fixed character set, e.g. "|="
In other words, I want to match: ( not ", not \r, not \n, and not |= ).
Thanks.
EDIT: I am trying to modify the regex for parsing data separated with delimiters. The single-delimiter solution I got form a CSV parser...
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,...
hi
can any body tell me how to use regex for negation of string?
I wanna find all line that start with public class and then any thing except first,second and finally any thing else.
for example in the result i expect to see public class base but not public class myfirst:base
can any body help me please??
...
I have a string on which I try to create a regex mask that will show N number of words, given an offset. Let's say I have the following string:
"The quick, brown fox jumps over the lazy dog."
I want to show 3 words at the time:
offset 0: "The quick, brown"
offset 1: "quick, brown fox"
offset 2: "brown fox jumps"
offset 3: "fox jumps o...
I need to match strings that don't contain a keyword (beta2) at an arbitrary position.
Consider:
var aStr = [
'/beta1/foo',
'beta1/foo',
'/beta1_xyz/foo',
'blahBlah/beta1/foo',
'beta1',
'/beta2/foo',
'beta2/foo',
...
I want to parse the output of a serial monitoring program called Docklight (I highly recommend it)
It outputs 'hexadecimal' strings: or a sequence of (two capital hex digits followed by a space). the corresponding regular expression is: ([0-9A-F]{2} )+ for example: '05 03 DA 4B 3F '
When program detects particular sequences of character...
Pretty much what the question says. I came up with
(ba)?(a + bb + bbbbb + aba)*(ab)?
Is there anything more readable? Or is this incorrect?
I know you shouldn't really be doing this sorta thing with Regex when you can just go !~/bbb/ in your code, but it's a theory exercise.
Thanks.
Edit for Clarification: I'm not using | to repre...
I'm trying to write a very simple regular expression that matches any file name that doesn't end in .php. I came up with the following...
(.*?)(?!\.php)$
...however this matches all filenames. If someone could point me in the right direction I'd be very grateful.
...
Possible Duplicate:
What regular expression can never match?
I'm looking for a regular expression that will not match any string.
Example:
suppose I have the following Java code
public boolean checkString(String lineInput, String regex)
{
final Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
final Matc...
I would like to create a match pattern for any opening brace that does not follow one of these patterns:
A:
{\n\n
B:
{\s*\/\/.*\n\(\s*\/\/.*\)\?\n
The more general problem is highlighting violations of a coding spec at work, which enforces a blank line following {
Clarification:
I'm looking for this to catch code like the followin...