ruby,regex,regex-negation
I have this working for my array: my_arr.delete_if{|x| x=~/achievement\..*?/} it deletes all strings in the array that match the pattern achievement.. Is there a similar one-liner to do the reverse (only accept strings that contain achievement.?...

c++,regex,boost,regex-negation
I'm locking for a boost regular expression that would exclude all strings that contains the character |. "1234|" should be exclude "|eee" should be exclude "...ff" should not be exclude. I can't change the code above to remove the negation of the result of boost::regex_match. if ( !boost::regex_match( sValue, boost::regex("[^\|]")...

java,regex,regex-negation
I'm trying to make a regex in Java that does not match excessive whitespaces between words, and whitespaces at the beginning and end. I have done this regex so far ^[\\S].*[\\S]$ That fail when there are whitespaces at the beginning and end of a line But how about excessive whitespaces...

regex,sublimetext,regex-negation,sublime-text-plugin
I installed a Sublime plugin called "SublimeOnSaveBuild" which compiles my sass files while saving. But now I'm going to work with more than just one file. The plugin offers a filter function which is checking if the filename matches the pattern \\.(sass|less|scss)$. But i need a pattern which matches any...

regex,notepad++,regex-negation
In Notepad++, I'm trying to match lines not starting with 32 consecutive spaces. I already have the regex that matches lines starting with 32 consecutive spaces: ^ {32}.*$ I tried with ^[^ {32}].*$ and ^[^( {32})].*$ with the same wrong result, doesn't match lines with only 24 spaces for example....

regex,regex-negation,regex-lookarounds
Is it possible to remove words in a sentence that doesn't contain a-z letters? I've thought about negative look arounds but wasn't successful. For example, This is a 1-2-a3 sample 12 -- 7-8 sentence becomes This is a 1-2-a3 sample sentence Assume all other punctuations were removed except dashes. Thanks!...

c#,asp.net,regex,regex-negation
I need to replace replaceString inside words, if it not starting with "@". For example: replaceString - replaced to : replacedString abc.replaceString - replaced to : abc.replacedString [email protected] - NOT replaced Im trying to use something like @"([email protected])replaceString$", but it not working properly....

javascript,regex,regex-negation
I am trying to incorporate the following negative lookahead regex ^(?!\*\*) into the following regex ^([a-z]:)?(\\[^<>:"/\\|?;,$=%@~]+)+\\?$ Basically, I don't want two consecutive asterisks (**) to appear anywhere in the file path. How do I modify the block [^<>:"/\\|?;,$=%@~] to incorporate this condition? I tried using escape characters, but to no...

ruby,regex,replace,regex-negation,replaceall
For a given text like pack: my box with five: dozen: liquor: jugs ::: : I want to replace all the : with ; that occur only after the words ack and zen. So the output I expect here is pack: my box with five; dozen: liquor; jugs ;;; ;...

python,regex,regex-negation
I have a simple function that yields all stretches of at least gapSize consecutive N's from a string: def get_gap_coordinates(sequence, gapSize=25): gapPattern = "N{"+str(gapSize)+",}" p = re.compile(gapPattern) m = p.finditer(sequence) for gap in m: start,stop = gap.span() yield(start,stop) Now I'd like to have a function that does the exact opposite:...

regex,r,regex-negation
Edit: Changing the whole question to make it clearer. Can I remove a single character from one of the regular expression classes in R (such as [:alnum:])? For example, match all punctuation ([:punct:]) except the _ character. I am trying the replace underscores used in markdown for italicizing but the...

postgresql,regex-negation,regexp-replace
i have a database export that come with some wrong chararacter substitution(like è => e'). So i have to change it back in postgres. I'm going crazy to make an all in one regex that catch something like this: cassine' de' pecche' e' it must become cassinè de' pecchè è...

regex,regex-negation,regular-language
I have written the regex below but I'm facing an issue: ^[^\.]*[a-zA-Z]+$ As per the above regex, df45543 is invalid, but I want to allow such a string. Only one alphabet character is mandatory and a dot is not allowed. All other characters are allowed....

regex,preg-match,regex-negation
I was told to validate the string like this -,-,-,9,- It was separated by , and contains 1 number(0-9), others are all - some examples: 9,-,-,-,- -,-,-,-,9 -,-,2,-,- How can I match this? And what concepts should I learn in regex? Update I miss the times, sorry, this string can...

javascript,regex,node.js,regex-negation
I need to split the text to the words but I also need to ignore the & character. That means for example the word "h & m" has stay together. Regex must also work in JavaScript and node.js. I used /(?!&)\s(?!&)/g. But that ignore space with & character only at...

regex,regex-negation,regex-lookarounds,regex-greedy,grunt-usemin
I'm trying to match the strings for image references but am picking up a little too much when there's an expression involved. In this example http://www.regexr.com/3b3ub, you'll see I'm doing good on the 1st and 3rd matches but I'm getting too much in the 2nd match. I only want the...

javascript,regex,regex-negation
How to check if URL string does not contain the following string: test/test/posts/search/1234567, so that when I provide the following URL: test/test/1234567 the match function would return: ["test/test/1234567", "test/test/", "", "1234567"]? Update: If I provide /posts/search in URL I would like to omit this regex in re.test(url) function. // var...

regex,regex-negation
Hi have a field were the user can enter a string with a limited set of tokens, say {token1}, {token2}. Token is a string between curly braces, no spaces allowed. I want to have the entry of the user checked with regex to invalidate when the user enters any unknown/invalid...

regex,regex-negation
Its easy to get a regular expression that gets you ALL the "com/net/org" Here it is: ^.+(com|org|net)$ BUT, I'm trying to find all domains that DON'T have a com/net/org I can't seem to find a way to negate the word group com/net/org Here are sample strings: piquetraveldesign.com rigall.com.au hunt4me.co.uk cialis-without-prescription.us...

regex,regex-negation,regex-lookarounds
I humbly request for some guidance on using multiple negative lookaheads in a regex. I currently have a string that matches up against 2 regular expressions. String: Armadale Joe Bloggs 22-333-222 20001 Whitfords to Butler ^Armadale\D+\d{2}-\d{3}-\d{2}\D+2\d{4}\D+$ (Armadale|Fremantle|Butler|Mandurah|Midland|Thornlie)\D+(?![0-9]{2}-[0-9]{3}-[0-9]{2})2[0-9]{4}\D+$ How can I modify Regex 2 so that it doesn't match the string?...

regex,regex-negation,regex-lookarounds
I'm trying to find all improperly-written commands in LaTeX that are NOT within math mode. That is, in the following, I want to match "\bad" but NOT "\good\" or "\math". Example of \bad command. Example of \good\ command. And $x=\math + y$ is also a good command. I figured out...

c#,regex,regex-negation,qregexp
I need to remove some tests from several classes without some specific category how do I match than? in this example i want to remove only the methods 'Bar' and 'BarTwo' namespace MyNameSpace { /// <summary> /// Some Stuff /// </summary> public class MyClass { [CategoryA] public void Foo() {...

python,regex,regex-negation
What would be an appropriate regex to remove all commas in a string as such: 12, 1425073747, "test", "1, 2, 3, ... " Result: 12, 1425073747, "test", "1 2 3 ... " What I have that matches correctly: "((\d+), )+\d+" However, I obviously cant replace this with $1 $2. I...

javascript,regex,regex-negation,regex-lookarounds
I wrote Regular expression for the below cases : only numbers(length:4) only alphabets(should contain vowel) ([0-9]{1,4})|((?=[a-z]*[aeiou])[a-z]*) eg: 9987, tyde How to add the below condition? Ignore the first two cases if the string contains alphanumeric characters. eg: 9ty87 ...

regex,shell,grep,regex-negation
I want to find lines that do not contain both "path": "/" and "User-Agent": "curl. Lines that contain only one of those should be included. In other words, how can I exclude a line only if it matches multiple patterns?...

regex,sitemap,regex-negation,regex-greedy,regedit
I have two URLs with the patterns: 1.http://localhost:9001/f/ 2.http://localhost:9001/flight/ I have a site filter which redirects to the respective sites if the regex matches. I tried the following regex patterns for the 2 URLs above: http?://localhost[^/]/f[^flight]/.* http?://localhost[^/]/flight/.* Both URLS are getting redirected to the first site, as both URLs are...

regex,python-3.x,regex-negation,regex-lookarounds
I'm using Python 3.4. I have three groups: g1 = 'g11|g12' g2 = 'g21|g22' g3 = 'g31|g32' I want to match any instance of g3, followed by anything except g2, followed by g1. Here are some strings on which I want to find a match: 'g31 anything or nothing g11'...

regex,regex-negation,regex-lookarounds
I'm using Python 3.4. Suppose we have four groups composed of regular expressions g1 = 'g11|g22|...|g1m' g2 = 'g21|g22|...|g2n' g3 = 'g32|g32|...|g3p' g4 = 'g41|g42|...|g4q' For example, g1 might be 'chickens|horses|bonnet(?>!blue )'. The groups are disjoint: no element in any of the four groups belongs to more than one group....

regex,regex-negation,regex-lookarounds
I am currently in need of a regex that can exclude a specific string but not words that include that string. For example if you have a string made of 0's and 1's. Any string that contains any number of 1's and any number of 0's except 3 0's exclusively....

jquery,regex,jquery-validate,regex-negation,negate
I'm working on a addition method for the jquery validate plugin which must detect if 3 or more consecutive identical characters are entered, and prompt a message. To do so I need to negate a regex expression. This is my method: $.validator.addMethod("pwcheckconsecchars", function (value) { return /(.)\1\1/.test(value) // does not...

regex,regex-negation
I want a regex to match everything in a string except "<br>", "<br />", "<br />". Reason being, i want to put string in a container and want "" tags to execute and display other tags as they are written by the user. For example: String--> "I have <br> <br...