Regex: How to retrieve all lines containing strA but not strB in Visual Studio
How can I retrieve all lines of a document containing "strA", but not "strB", in the Visual Studio search box? ...
How can I retrieve all lines of a document containing "strA", but not "strB", in the Visual Studio search box? ...
Which regular expression can I use to find all strings bar are not preceded by string foo? Having whitespace between the two is also illegal. So the regex should match the following strings foo is bar hello bar But not these foobar foo bar I've tried using the following (?!<foo)bar and it gets the work done for eliminating ...
Hi, Does anybody know how to code a regular expression (for use with some grep like tool) which will search for the word 'vat' but exclude the word 'pri**vat**e'. I've taken over a project which has hundreds of references to VAT (some hard-coded, some not) and as the VAT rate in the UK is changing on January 1 I need to update the proj...
I want to match all punctuations, but not "'", as in "I'm". For example, in the sentence below: I'm a student, but I'm also working. ^not match ^match ^not ^match I can use "[[:punct:]]+" to match all punctuations, but I'm having hard time to exclude "'" from the matching pattern. Of course, I could use someting like the...
I've been able to stumble my way through regular expressions for quite some time, but alas, I cannot help a friend in need. My "friend" is trying to match all lines in a text file that match the following criteria: Only a 7 to 10 digit number (0123456 or 0123456789) Only a 7 to 10 digit number, then a dash, then another two digits (01...
I've searched for questions like this, but all the cases I found were solved in a problem-specific manner, like using !g in vi to negate the regex matches, or matching other things, without a regex negation. Thus, I'm interested in a “pure” solution to this: Having a set of strings I need to filter them with a regular expression matche...
I'm trying to write a regex pattern that will find numbers with two leading 00's in it in a string and replace it with a single 0. The problem is that I want to ignore numbers in parentheses and I can't figure out how to do this. For example, with the string: Somewhere 001 (2009) I want to return: Somewhere 01 (2009) I can search...
I would like to extract text from an html document keeping the links inside it. for example: From this HTML code <div class="CssClass21">bla1 bla1 bla1 <a href="http://www.ibrii.com">go to ibrii</a> bla2 bla2 bla2 <img src="http://www.contoso.com/hello.jpg"> <span class="cssClass34">hello hello</span> I would like to extract ju...
Following on from a previous question in which I asked: How can I use a regular expression to match text that is between two strings, where those two strings are themselves enclosed two other strings, with any amount of text between the inner and outer enclosing strings? I got this answer: /outer-start.*?inner-start(.*?)inner-end....
Multiline Test string: dkdkdkdk dkdkdkdk dkdkdkd dkdkdkd "hello" dkdkdkdkdk dkdkdk "goodbye.hello" dkdkdkd kdkdkd kdkdkdk "hello.goodbye.hello" dddd "test" ssss "http:x-y.f/z/z" "" "." "http:/dkdkd/dkdkdk/dkdkdkdkdkdk.g" I want to match every quoted string that contains "hello" This matches every quoted string \"(.+?)\" This matc...
How can I match an alpha character with a regular expression. I want a character that is in \w but is not in \d. I want it unicode compatible that's why I cannot use [a-zA-Z]. ...
For PMD I'd like to have a rule which warns me of those ugly variables which start with my. This means I have to accept all variables which do NOT start with my. So, I need a RegEx (re) which behaves as follows: re.match('myVar') == false re.match('manager') == true re.match('thisIsMyVar') == true re.match('myOtherVar') == f...
Q-1. match url that doesn't contain asp, apsx, css, htm.html,jpg, Q-2. match url that doesn't end with asp, apsx, css, htm.html,jpg, ...
I am stumped trying to create an Emacs regular-expression that excludes groups. [^] excludes individual characters in a set, but I want to exclude specific sequences of characters: something like [^(not|this)], so that strings containing "not" or "this" are not matched. In principle, I could write ([^n][^o][^t]|[^...]), but is there ano...
So I have some string: //Blah blah blach // sdfkjlasdf "Another //thing" And I'm using java regex to replace all the lines that have double slashes like so: theString = Pattern.compile("//(.*?)\\n", Pattern.DOTALL).matcher(theString).replaceAll(""); And it works for the most part, but the problem is it removes all the occurrences a...
I'm trying to write a parser that uses two characters as token boundaries, but I can't figure out the regular expression that will allow me to ignore them when I'm regex-escaping the whole string. Given a string like: This | is || token || some ||| text I would like to end up with: This \| is || token || some \|\|\| text where all...
I have a simple grammar setup like so: grammar Test rule line (adjective / not_adjective)* { def content elements.map{|e| e.content } end } end rule adjective ("good" / "bad" / "excellent") { def content [:adjective, text_value] end } e...
Hey guys, I've got a regex issue, I'm trying to ignore just the number '41', I want 4, 1, 14 etc to all match. I've got this [^\b41\b] which is effectively what I want but this also ignores all single iterations of the values 1 and 4. As an example, this matches "41", but I want it to NOT match: \b41\b ...
I'm trying to run a unix regEXP on every log file in a 1.12 GB directory, then replace the matched pattern with ''. Test run on a 4 meg file took about 10 minutes, but worked. Obviously something is damaging performance by several orders of magnitude. UPDATE: I am noticing that searching for ^(155[0-2]).*$ takes ~7 seconds in a 5.6 MB f...
I have a regex, for example (ma|(t){1}). It matches ma and t and doesn't match bla. I want to negate the regex, thus it must match bla and not ma and t, by adding something to this regex. I know I can write bla, the actual regex is however more complex. ...